bug fix
This commit is contained in:
@@ -144,9 +144,10 @@ namespace TinySTL{
|
||||
void binary_search_tree<T>::insert_elem(const T& val, node *&ptr){//<2F>ظ<EFBFBD><D8B8><EFBFBD>Ԫ<EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (ptr == 0){
|
||||
ptr = nodeAllocator::allocate();
|
||||
memset(ptr, 0, sizeof(node));
|
||||
ptr->data_ = val;
|
||||
//ptr->left_ = ptr->right_ = 0;
|
||||
construct(&(ptr->data_, val));
|
||||
/*memset(ptr, 0, sizeof(node));
|
||||
ptr->data_ = val;*/
|
||||
ptr->left_ = ptr->right_ = 0;
|
||||
++size_;
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -154,7 +154,8 @@ namespace TinySTL{
|
||||
nodePtr newNode(const T& val = T()){
|
||||
nodePtr res = nodeAllocator::allocate();
|
||||
res->container = this;
|
||||
res->data = val;
|
||||
//res->data = val; -> bug
|
||||
construct(&(res->data), val);//fix
|
||||
res->prev = nullptr;
|
||||
res->next = nullptr;
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user