list_of_workaround.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Boost.Assign library
  2. //
  3. // Copyright Thorsten Ottosen 2003-2004. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // For more information, see http://www.boost.org/libs/assign/
  9. //
  10. #include <boost/detail/workaround.hpp>
  11. #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
  12. # pragma warn -8091 // suppress warning in Boost.Test
  13. # pragma warn -8057 // unused argument argc/argv in Boost.Test
  14. #endif
  15. #include <boost/assign/list_of.hpp>
  16. #include <boost/test/test_tools.hpp>
  17. #include <vector>
  18. #include <set>
  19. #include <map>
  20. #include <stack>
  21. #include <queue>
  22. #include <boost/array.hpp>
  23. void check_list_of()
  24. {
  25. using namespace std;
  26. using namespace boost;
  27. using namespace boost::assign;
  28. using boost::array;
  29. vector<int> v = list_of(1)(2)(3)(4).to_container( v );
  30. set<int> s = list_of(1)(2)(3)(4).to_container( s );
  31. map<int,int> m = map_list_of(1,2)(2,3).to_container( m );
  32. stack<int> st = list_of(1)(2)(3)(4).to_adapter( st );
  33. queue<int> q = list_of(1)(2)(3)(4).to_adapter( q );
  34. array<int,4> a = list_of(1)(2)(3)(4).to_array( a );
  35. const vector<int> v2 = list_of(1).to_container( v2 );
  36. const array<int,1> a2 = list_of(1).to_array( a2 );
  37. }
  38. #include <boost/test/unit_test.hpp>
  39. using boost::unit_test::test_suite;
  40. test_suite* init_unit_test_suite( int argc, char* argv[] )
  41. {
  42. test_suite* test = BOOST_TEST_SUITE( "List Test Suite" );
  43. test->add( BOOST_TEST_CASE( &check_list_of ) );
  44. return test;
  45. }