bug fix
This commit is contained in:
@@ -186,8 +186,9 @@ namespace TinySTL{
|
|||||||
nodePtr newNode(const T& val = T()){
|
nodePtr newNode(const T& val = T()){
|
||||||
nodePtr res = nodeAllocator::allocate();
|
nodePtr res = nodeAllocator::allocate();
|
||||||
res->container = this;
|
res->container = this;
|
||||||
//res->data = val; -> bug
|
//res->data = val; //-> bug
|
||||||
nodeAllocator::construct(&(res->data), val);//fix
|
//nodeAllocator::construct(&(res->data), val);
|
||||||
|
TinySTL::construct(&(res->data), val);//fix
|
||||||
res->prev = nullptr;
|
res->prev = nullptr;
|
||||||
res->next = nullptr;
|
res->next = nullptr;
|
||||||
return res;
|
return res;
|
||||||
@@ -215,7 +216,8 @@ namespace TinySTL{
|
|||||||
friend bool operator== (const list<T>& lhs, const list<T>& rhs);
|
friend bool operator== (const list<T>& lhs, const list<T>& rhs);
|
||||||
template <class T>
|
template <class T>
|
||||||
friend bool operator!= (const list<T>& lhs, const list<T>& rhs);
|
friend bool operator!= (const list<T>& lhs, const list<T>& rhs);
|
||||||
};
|
};//end of List
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void list<T>::push_front(const value_type& val){
|
void list<T>::push_front(const value_type& val){
|
||||||
auto node = newNode(val);
|
auto node = newNode(val);
|
||||||
|
|||||||
Reference in New Issue
Block a user