Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54779 - trunk/libs/ptr_container/test
From: nesotto_at_[hidden]
Date: 2009-07-07 15:21:25


Author: nesotto
Date: 2009-07-07 15:21:24 EDT (Tue, 07 Jul 2009)
New Revision: 54779
URL: http://svn.boost.org/trac/boost/changeset/54779

Log:
initial support for const elements in containers
Added:
   trunk/libs/ptr_container/test/const_element_containers.cpp (contents, props changed)
Text files modified:
   trunk/libs/ptr_container/test/Jamfile.v2 | 1 +
   trunk/libs/ptr_container/test/ptr_list.cpp | 1 -
   2 files changed, 1 insertions(+), 1 deletions(-)

Modified: trunk/libs/ptr_container/test/Jamfile.v2
==============================================================================
--- trunk/libs/ptr_container/test/Jamfile.v2 (original)
+++ trunk/libs/ptr_container/test/Jamfile.v2 2009-07-07 15:21:24 EDT (Tue, 07 Jul 2009)
@@ -38,6 +38,7 @@
     [ sc-test ptr_unordered_set ]
     [ sc-test ptr_unordered_map ]
     [ sc-test ptr_circular_buffer ]
+ [ sc-test const_element_containers ]
  # [ sc-test null_filter_iterator ]
   
     ;

Added: trunk/libs/ptr_container/test/const_element_containers.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/ptr_container/test/const_element_containers.cpp 2009-07-07 15:21:24 EDT (Tue, 07 Jul 2009)
@@ -0,0 +1,77 @@
+//
+// Boost.Pointer Container
+//
+// Copyright Thorsten Ottosen 2009. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// For more information, see http://www.boost.org/libs/ptr_container/
+//
+
+#include <boost/ptr_container/ptr_container.hpp>
+#include <boost/test/unit_test.hpp>
+
+template< class T >
+void test_instantiations()
+{
+ // force instantiation of all members
+ template class
+ boost::ptr_array<T,42>;
+
+ template class
+ boost::ptr_deque<T>;
+
+ template class
+ boost::ptr_list<T>;
+
+ template class
+ boost::ptr_map<int,T>;
+
+ template class
+ boost::ptr_vector<T>;
+
+ //@todo problem with constructor forwarding
+ //template class
+ //boost::ptr_unordered_map<int,T>;
+
+ // @todo: there seems to be some problems with
+ // argument passing in circular_buffer
+ //boost::ptr_circular_buffer<T> buffer(32);
+ //buffer.push_back( new int(42) );
+}
+
+
+
+void test_const_element_container()
+{
+ test_instantiations<const int>();
+ test_instantiations< boost::nullable<const int> >();
+
+ template class
+ boost::ptr_set<const int>;
+
+ // @todo: problem with constructor forwarding
+ //template class
+ //boost::ptr_unordered_set<T>;
+
+}
+
+
+
+using boost::unit_test::test_suite;
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite* test = BOOST_TEST_SUITE( "Pointer Container Test Suite" );
+
+ test->add( BOOST_TEST_CASE( &test_const_element_container ) );
+
+ return test;
+}
+
+
+
+
+
+

Modified: trunk/libs/ptr_container/test/ptr_list.cpp
==============================================================================
--- trunk/libs/ptr_container/test/ptr_list.cpp (original)
+++ trunk/libs/ptr_container/test/ptr_list.cpp 2009-07-07 15:21:24 EDT (Tue, 07 Jul 2009)
@@ -46,7 +46,6 @@
     list.push_front( new int(3) );
     list.push_front( std::auto_ptr<int>( new int(42) ) );
     list.reverse();
-
 }
 
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk