Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59480 - sandbox/statistics/detail/assign/libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-02-04 15:19:46


Author: e_r
Date: 2010-02-04 15:19:45 EST (Thu, 04 Feb 2010)
New Revision: 59480
URL: http://svn.boost.org/trac/boost/changeset/59480

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp | 27 ++++++++++++++++++++++-----
   1 files changed, 22 insertions(+), 5 deletions(-)

Modified: sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp (original)
+++ sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp 2010-02-04 15:19:45 EST (Thu, 04 Feb 2010)
@@ -20,6 +20,9 @@
         using namespace boost::assign;
     
           typedef std::vector<int> ints_;
+ typedef boost::array<int,3> array_;
+ array_ array0 = {{-1,-1,-1}};
+ array_ array = array0;
 
         {
             int a=1,b=2,c=3;
@@ -29,14 +32,23 @@
                 BOOST_ASSERT(ints[0] == a);
                 BOOST_ASSERT(ints[1] == b);
                 BOOST_ASSERT(ints[2] == 3);
-
+ array = array0;
+ array = cref_list_of<3>(a)(b)(3);
+ BOOST_ASSERT(array[0] == a);
+ BOOST_ASSERT(array[1] == b);
+ BOOST_ASSERT(array[2] == c);
+
                 // cref_list_of2
             ints.clear();
                 ints = cref_list_of2(a)(b)(3);
                 BOOST_ASSERT(ints[0] == a);
                 BOOST_ASSERT(ints[1] == b);
- BOOST_ASSERT(ints[2] == 3);
-
+ BOOST_ASSERT(ints[2] == c);
+ array = array0;
+ array = cref_list_of2(a)(b)(3);
+ BOOST_ASSERT(array[0] == a);
+ BOOST_ASSERT(array[1] == b);
+ BOOST_ASSERT(array[2] == c);
                 {
                     ints.clear();
                 BOOST_AUTO(
@@ -46,7 +58,7 @@
                 ints = ints_(boost::begin(tmp),boost::end(tmp));
                         BOOST_ASSERT(ints[0] == a);
                         BOOST_ASSERT(ints[1] == b);
- BOOST_ASSERT(ints[2] == 3);
+ BOOST_ASSERT(ints[2] == c);
                 }
 
                 // ref_list_of2
@@ -55,6 +67,11 @@
                 BOOST_ASSERT(ints[0] == a);
                 BOOST_ASSERT(ints[1] == b);
                 BOOST_ASSERT(ints[2] == c);
+ array = array0;
+ array = ref_list_of2(a)(b)(c);
+ BOOST_ASSERT(array[0] == a);
+ BOOST_ASSERT(array[1] == b);
+ BOOST_ASSERT(array[2] == c);
         
                 {
                     ints.clear();
@@ -65,7 +82,7 @@
                 ints = ints_(boost::begin(tmp),boost::end(tmp));
                         BOOST_ASSERT(ints[0] == a);
                         BOOST_ASSERT(ints[1] == b);
- BOOST_ASSERT(ints[2] == 3);
+ BOOST_ASSERT(ints[2] == c);
                 }
         
     }


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