From 4c88ceaad8886edba9fa439d24f1ec7b5d9e186d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Mon, 12 Jan 2015 13:49:47 +0800 Subject: [PATCH] bug fix --- TinySTL/List.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/TinySTL/List.h b/TinySTL/List.h index f61971c..21a773c 100644 --- a/TinySTL/List.h +++ b/TinySTL/List.h @@ -186,8 +186,9 @@ namespace TinySTL{ nodePtr newNode(const T& val = T()){ nodePtr res = nodeAllocator::allocate(); res->container = this; - //res->data = val; -> bug - nodeAllocator::construct(&(res->data), val);//fix + //res->data = val; //-> bug + //nodeAllocator::construct(&(res->data), val); + TinySTL::construct(&(res->data), val);//fix res->prev = nullptr; res->next = nullptr; return res; @@ -215,7 +216,8 @@ namespace TinySTL{ friend bool operator== (const list& lhs, const list& rhs); template friend bool operator!= (const list& lhs, const list& rhs); - }; + };//end of List + template void list::push_front(const value_type& val){ auto node = newNode(val);