Update cpp.h

This commit is contained in:
Gangphon 2024-08-08 16:52:25 +08:00
parent c1e840be1f
commit 5deed3f75e

View File

@ -85,9 +85,7 @@ template <class V>
class Vector : public SharedPtr<std::vector<V>> { class Vector : public SharedPtr<std::vector<V>> {
public: public:
using SharedPtr<std::vector<V>>::SharedPtr; using SharedPtr<std::vector<V>>::SharedPtr;
typedef typename std::vector<V>::iterator iterator;
using iterator = std::_Vector_iterator<std::_Vector_val<std::_Simple_types<V>>>;
using const_iterator = std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<V>>>;
Vector(std::initializer_list<V> _Ilist) { Vector(std::initializer_list<V> _Ilist) {
this->ptr = new SharedData<std::vector<V>>{1, _Ilist}; this->ptr = new SharedData<std::vector<V>>{1, _Ilist};
@ -98,7 +96,7 @@ public:
return *this; return *this;
} }
Vector &append(V&& val) { Vector &append(V&& val) {
(*this)->push_back(_STD move(val)); (*this)->push_back(std::move(val));
return *this; return *this;
} }
Vector &operator<<(const V &val) { Vector &operator<<(const V &val) {
@ -106,7 +104,7 @@ public:
return *this; return *this;
} }
Vector &operator<<(V&& val) { Vector &operator<<(V&& val) {
(*this)->push_back(_STD move(val)); (*this)->push_back(std::move(val));
return *this; return *this;
} }
@ -127,8 +125,8 @@ public:
struct NodeBase { struct NodeBase {
NodeBase *next{this}; NodeBase *next = this;
NodeBase *prev{this}; NodeBase *prev = this;
}; };
template <class P> template <class P>
struct _Node : NodeBase { struct _Node : NodeBase {