|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62931 - sandbox/statistics/support/libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-06-14 09:47:07
Author: e_r
Date: 2010-06-14 09:47:06 EDT (Mon, 14 Jun 2010)
New Revision: 62931
URL: http://svn.boost.org/trac/boost/changeset/62931
Log:
m
Text files modified:
sandbox/statistics/support/libs/assign/example/range.cpp | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
Modified: sandbox/statistics/support/libs/assign/example/range.cpp
==============================================================================
--- sandbox/statistics/support/libs/assign/example/range.cpp (original)
+++ sandbox/statistics/support/libs/assign/example/range.cpp 2010-06-14 09:47:06 EDT (Mon, 14 Jun 2010)
@@ -1,5 +1,5 @@
//////////////////////////////////////////////////////////////////////////////
-// range.cpp //
+// range.cpp //
// //
//////////////////////////////////////////////////////////////////////////////
#include <ostream>
@@ -10,6 +10,7 @@
#include <boost/next_prior.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/assign/auto_size/ref_list_of.hpp>
+#include <boost/assign/auto_size/ref_csv.hpp>
#include <boost/assign/auto_size/range/basic_chain.hpp>
#include <boost/assign/auto_size/range/chain_l.hpp>
#include <boost/assign/auto_size/range/chain_r.hpp>
@@ -67,19 +68,34 @@
}
{
-
+ // [Boost.Assign] list_of::range without an initial (single) element?
boost::array<int, 2> a = { 1, 2 };
boost::array<int, 2> b = { 3, 4 };
boost::array<int, 4> c = a && b;
- BOOST_ASSERT(c[0]==1);
- BOOST_ASSERT(c[1]==2);
- BOOST_ASSERT(c[2]==3);
- BOOST_ASSERT(c[3]==4);
- BOOST_ASSERT(c.size() == 4);
+ BOOST_ASSERT( c[0]==1 );
+ BOOST_ASSERT( c[1]==2 );
+ BOOST_ASSERT( c[2]==3 );
+ BOOST_ASSERT( c[3]==4 );
+ BOOST_ASSERT( c.size() == 4 );
os << "array : OK" << std::endl;
}
+{
+ // make<std::vector>(1,2,3,4,5); // Makes a std::vector<int> containing 1,2,3,4,5
+
+ list_of(1)(2)(3)(4)(5).convert_to_container<std::vector<int> >();
+ cref_csv(1,2,3,4,5).convert_to_container<std::vector<int> >();
+ std::vector<int> vec = cref_csv(1,2,3,4,5);
+ BOOST_ASSERT( vec[0]==1 );
+ BOOST_ASSERT( vec[1]==2 );
+ BOOST_ASSERT( vec[2]==3 );
+ BOOST_ASSERT( vec[3]==4 );
+ BOOST_ASSERT( vec[4]==5 );
+ BOOST_ASSERT( vec.size() == 5 );
+
+}
+
os << "<- " << std::endl;
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