This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Add variadic construct to the allocators (in C++0x mode)


Hi,

tested x86_64-linux, committed to mainline.

Paolo.

//////////////////////
2007-10-26  Paolo Carlini  <pcarlini@suse.de>

	* include/ext/throw_allocator.h (throw_allocator<>::
	construct<>(pointer, _Args&&...)): Add.
	* include/ext/pool_allocator.h (__pool_alloc<>::
	construct<>(pointer, _Args&&...)): Likewise.
	(construct(pointer, const _Tp&)): Cast pointer to void*. 
	* include/ext/bitmap_allocator.h (bitmap_allocator<>::
	construct<>(pointer, _Args&&...)): Add.
	(construct(pointer, const _Tp&)): Cast pointer to void*.
	* include/ext/new_allocator.h (new_allocator<>::
	construct<>(pointer, _Args&&...)): Add.
	(construct(pointer, const _Tp&)): Cast pointer to void*.
	* include/ext/malloc_allocator.h (malloc_allocator<>::
	construct<>(pointer, _Args&&...)): Add.
	(construct(pointer, const _Tp&)): Cast pointer to void*.
	* include/ext/array_allocator.h (array_allocator<>::
	construct<>(pointer, _Args&&...)): Add.
	(construct(pointer, const _Tp&)): Cast pointer to void*.
	* include/ext/mt_allocator.h (__mt_alloc<>::
	construct<>(pointer, _Args&&...)): Add.
	(construct(pointer, const _Tp&)): Cast pointer to void*.
	* testsuite/util/testsuite_allocator.h (tracker_allocator<>::
	construct<>(pointer, _Args&&...)): Add.
	(construct(pointer, const _Tp&)): Cast pointer to void*.
 	(uneq_allocator<>::construct<>(pointer, _Args&&...)): Add.
	(construct(pointer, const _Tp&)): Cast pointer to void*.
	* testsuite/ext/mt_allocator/variadic_construct.cc: New.
	* testsuite/ext/new_allocator/variadic_construct.cc: Likewise.
	* testsuite/ext/throw_allocator/variadic_construct.cc: Likewise.
	* testsuite/ext/malloc_allocator/variadic_construct.cc: Likewise.
	* testsuite/ext/pool_allocator/variadic_construct.cc: Likewise.
	* testsuite/ext/bitmap_allocator/variadic_construct.cc: Likewise.
	* testsuite/ext/array_allocator/variadic_construct.cc: Likewise.

Index: include/ext/throw_allocator.h
===================================================================
--- include/ext/throw_allocator.h	(revision 129657)
+++ include/ext/throw_allocator.h	(working copy)
@@ -60,6 +60,7 @@
 #include <utility>
 #include <tr1/random>
 #include <bits/functexcept.h>
+#include <bits/stl_move.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
@@ -232,6 +233,16 @@
       construct(pointer __p, const T& val)
       { return std::allocator<value_type>().construct(__p, val); }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+        void
+        construct(pointer __p, _Args&&... __args)
+	{ 
+	  return std::allocator<value_type>().
+	    construct(__p, std::forward<_Args>(__args)...);
+	}
+#endif
+
       void
       destroy(pointer __p)
       { std::allocator<value_type>().destroy(__p); }
Index: include/ext/pool_allocator.h
===================================================================
--- include/ext/pool_allocator.h	(revision 129657)
+++ include/ext/pool_allocator.h	(working copy)
@@ -54,6 +54,7 @@
 #include <bits/functexcept.h>
 #include <ext/atomicity.h>
 #include <ext/concurrence.h>
+#include <bits/stl_move.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
@@ -164,7 +165,14 @@
       // 402. wrong new expression in [some_] allocator::construct
       void 
       construct(pointer __p, const _Tp& __val) 
-      { ::new(__p) _Tp(__val); }
+      { ::new((void *)__p) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+        void
+        construct(pointer __p, _Args&&... __args)
+	{ ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
 
       void 
       destroy(pointer __p) { __p->~_Tp(); }
Index: include/ext/bitmap_allocator.h
===================================================================
--- include/ext/bitmap_allocator.h	(revision 129657)
+++ include/ext/bitmap_allocator.h	(working copy)
@@ -1,6 +1,6 @@
 // Bitmap Allocator. -*- C++ -*-
 
-// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@
 #include <new> // For operator new.
 #include <debug/debug.h> // _GLIBCXX_DEBUG_ASSERT
 #include <ext/concurrence.h>
-
+#include <bits/stl_move.h>
 
 /** @brief The constant in the expression below is the alignment
  * required in bytes.
@@ -1089,7 +1089,14 @@
 
       void 
       construct(pointer __p, const_reference __data)
-      { ::new(__p) value_type(__data); }
+      { ::new((void *)__p) value_type(__data); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+        void
+        construct(pointer __p, _Args&&... __args)
+	{ ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
 
       void 
       destroy(pointer __p)
Index: include/ext/new_allocator.h
===================================================================
--- include/ext/new_allocator.h	(revision 129657)
+++ include/ext/new_allocator.h	(working copy)
@@ -36,6 +36,7 @@
 
 #include <new>
 #include <bits/functexcept.h>
+#include <bits/stl_move.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
@@ -104,7 +105,14 @@
       // 402. wrong new expression in [some_] allocator::construct
       void 
       construct(pointer __p, const _Tp& __val) 
-      { ::new(__p) _Tp(__val); }
+      { ::new((void *)__p) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+        void
+        construct(pointer __p, _Args&&... __args)
+	{ ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
 
       void 
       destroy(pointer __p) { __p->~_Tp(); }
Index: include/ext/malloc_allocator.h
===================================================================
--- include/ext/malloc_allocator.h	(revision 129657)
+++ include/ext/malloc_allocator.h	(working copy)
@@ -1,6 +1,6 @@
 // Allocator that wraps "C" malloc -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -38,6 +38,7 @@
 #include <cstdlib>
 #include <new>
 #include <bits/functexcept.h>
+#include <bits/stl_move.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
@@ -109,7 +110,14 @@
       // 402. wrong new expression in [some_] allocator::construct
       void 
       construct(pointer __p, const _Tp& __val) 
-      { ::new(__p) value_type(__val); }
+      { ::new((void *)__p) value_type(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+        void
+        construct(pointer __p, _Args&&... __args) 
+	{ ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
 
       void 
       destroy(pointer __p) { __p->~_Tp(); }
Index: include/ext/array_allocator.h
===================================================================
--- include/ext/array_allocator.h	(revision 129657)
+++ include/ext/array_allocator.h	(working copy)
@@ -1,6 +1,6 @@
 // array allocator -*- C++ -*-
 
-// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -38,6 +38,7 @@
 #include <new>
 #include <bits/functexcept.h>
 #include <tr1/array>
+#include <bits/stl_move.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
@@ -77,7 +78,14 @@
       // 402. wrong new expression in [some_] allocator::construct
       void 
       construct(pointer __p, const _Tp& __val) 
-      { ::new(__p) value_type(__val); }
+      { ::new((void *)__p) value_type(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+        void
+        construct(pointer __p, _Args&&... __args)
+	{ ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
 
       void 
       destroy(pointer __p) { __p->~_Tp(); }
Index: include/ext/mt_allocator.h
===================================================================
--- include/ext/mt_allocator.h	(revision 129657)
+++ include/ext/mt_allocator.h	(working copy)
@@ -1,6 +1,6 @@
 // MT-optimized allocator -*- C++ -*-
 
-// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -38,6 +38,7 @@
 #include <cstdlib>
 #include <bits/functexcept.h>
 #include <ext/atomicity.h>
+#include <bits/stl_move.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
@@ -593,7 +594,14 @@
       // 402. wrong new expression in [some_] allocator::construct
       void 
       construct(pointer __p, const _Tp& __val) 
-      { ::new(__p) _Tp(__val); }
+      { ::new((void *)__p) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+        void
+        construct(pointer __p, _Args&&... __args)
+	{ ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
 
       void 
       destroy(pointer __p) { __p->~_Tp(); }
Index: testsuite/ext/mt_allocator/variadic_construct.cc
===================================================================
--- testsuite/ext/mt_allocator/variadic_construct.cc	(revision 0)
+++ testsuite/ext/mt_allocator/variadic_construct.cc	(revision 0)
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <ext/mt_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::pair<int, char> pair_type;
+  __gnu_cxx::__mt_alloc<pair_type> alloc1;
+
+  pair_type* ptp1 = alloc1.allocate(1);
+  alloc1.construct(ptp1, 3, 'a');
+
+  VERIFY( ptp1->first == 3 );
+  VERIFY( ptp1->second == 'a' );
+
+  alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
Index: testsuite/ext/new_allocator/variadic_construct.cc
===================================================================
--- testsuite/ext/new_allocator/variadic_construct.cc	(revision 0)
+++ testsuite/ext/new_allocator/variadic_construct.cc	(revision 0)
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <ext/new_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::pair<int, char> pair_type;
+  __gnu_cxx::new_allocator<pair_type> alloc1;
+
+  pair_type* ptp1 = alloc1.allocate(1);
+  alloc1.construct(ptp1, 3, 'a');
+
+  VERIFY( ptp1->first == 3 );
+  VERIFY( ptp1->second == 'a' );
+
+  alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
Index: testsuite/ext/throw_allocator/variadic_construct.cc
===================================================================
--- testsuite/ext/throw_allocator/variadic_construct.cc	(revision 0)
+++ testsuite/ext/throw_allocator/variadic_construct.cc	(revision 0)
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <ext/throw_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::pair<int, char> pair_type;
+  __gnu_cxx::throw_allocator<pair_type> alloc1;
+
+  pair_type* ptp1 = alloc1.allocate(1);
+  alloc1.construct(ptp1, 3, 'a');
+
+  VERIFY( ptp1->first == 3 );
+  VERIFY( ptp1->second == 'a' );
+
+  alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
Index: testsuite/ext/malloc_allocator/variadic_construct.cc
===================================================================
--- testsuite/ext/malloc_allocator/variadic_construct.cc	(revision 0)
+++ testsuite/ext/malloc_allocator/variadic_construct.cc	(revision 0)
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <ext/malloc_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::pair<int, char> pair_type;
+  __gnu_cxx::malloc_allocator<pair_type> alloc1;
+
+  pair_type* ptp1 = alloc1.allocate(1);
+  alloc1.construct(ptp1, 3, 'a');
+
+  VERIFY( ptp1->first == 3 );
+  VERIFY( ptp1->second == 'a' );
+
+  alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
Index: testsuite/ext/pool_allocator/variadic_construct.cc
===================================================================
--- testsuite/ext/pool_allocator/variadic_construct.cc	(revision 0)
+++ testsuite/ext/pool_allocator/variadic_construct.cc	(revision 0)
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <ext/pool_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::pair<int, char> pair_type;
+  __gnu_cxx::__pool_alloc<pair_type> alloc1;
+
+  pair_type* ptp1 = alloc1.allocate(1);
+  alloc1.construct(ptp1, 3, 'a');
+
+  VERIFY( ptp1->first == 3 );
+  VERIFY( ptp1->second == 'a' );
+
+  alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
Index: testsuite/ext/bitmap_allocator/variadic_construct.cc
===================================================================
--- testsuite/ext/bitmap_allocator/variadic_construct.cc	(revision 0)
+++ testsuite/ext/bitmap_allocator/variadic_construct.cc	(revision 0)
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <ext/bitmap_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::pair<int, char> pair_type;
+  __gnu_cxx::bitmap_allocator<pair_type> alloc1;
+
+  pair_type* ptp1 = alloc1.allocate(1);
+  alloc1.construct(ptp1, 3, 'a');
+
+  VERIFY( ptp1->first == 3 );
+  VERIFY( ptp1->second == 'a' );
+
+  alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
Index: testsuite/ext/array_allocator/variadic_construct.cc
===================================================================
--- testsuite/ext/array_allocator/variadic_construct.cc	(revision 0)
+++ testsuite/ext/array_allocator/variadic_construct.cc	(revision 0)
@@ -0,0 +1,50 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-27  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 20.4.1.1 allocator members
+
+#include <ext/array_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::pair<int, char> pair_type;
+  typedef std::tr1::array<pair_type, 3> array_type;
+  array_type store;
+
+  __gnu_cxx::array_allocator<pair_type, array_type> alloc1(&store);
+  pair_type* ptp1 = alloc1.allocate(1);
+  alloc1.construct(ptp1, 3, 'a');
+
+  VERIFY( ptp1->first == 3 );
+  VERIFY( ptp1->second == 'a' );
+
+  alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
Index: testsuite/util/testsuite_allocator.h
===================================================================
--- testsuite/util/testsuite_allocator.h	(revision 129657)
+++ testsuite/util/testsuite_allocator.h	(working copy)
@@ -39,6 +39,7 @@
 #include <cstddef>
 #include <tr1/unordered_map>
 #include <cassert>
+#include <bits/stl_move.h>
 
 namespace 
 {
@@ -153,10 +154,20 @@
     void
     construct(pointer p, const T& value)
     {
-      new (p) T(value);
+      ::new ((void *)p) T(value);
       counter_type::construct();
     }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... Args>
+        void
+        construct(pointer p, Args&&... args) 
+	{
+	  ::new((void *)p) T(std::forward<Args>(args)...);
+	  counter_type::construct();
+	}
+#endif
+
     void
     destroy(pointer p)
     {
@@ -338,8 +349,15 @@
       
       void 
       construct(pointer p, const Tp& val) 
-      { ::new(p) Tp(val); }
-    
+      { ::new((void *)p) Tp(val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... Args>
+        void
+        construct(pointer p, Args&&... args) 
+	{ ::new((void *)p) Tp(std::forward<Args>(args)...); }
+#endif
+
       void 
       destroy(pointer p) { p->~Tp(); }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]