|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63003 - in sandbox/statistics/support/libs/assign: doc example src
From: erwann.rogard_at_[hidden]
Date: 2010-06-15 17:14:08
Author: e_r
Date: 2010-06-15 17:14:07 EDT (Tue, 15 Jun 2010)
New Revision: 63003
URL: http://svn.boost.org/trac/boost/changeset/63003
Log:
updated rev history and added a few examples
Text files modified:
sandbox/statistics/support/libs/assign/doc/revision_history.txt | 8 ++++++++
sandbox/statistics/support/libs/assign/example/range.cpp | 26 +++++++++++++++++++++++++-
sandbox/statistics/support/libs/assign/src/main.cpp | 3 +--
3 files changed, 34 insertions(+), 3 deletions(-)
Modified: sandbox/statistics/support/libs/assign/doc/revision_history.txt
==============================================================================
--- sandbox/statistics/support/libs/assign/doc/revision_history.txt (original)
+++ sandbox/statistics/support/libs/assign/doc/revision_history.txt 2010-06-15 17:14:07 EDT (Tue, 15 Jun 2010)
@@ -1,5 +1,13 @@
// Revision history:
//
+//
+// June 15th, 2010. The argument r in
+// Container convert( const Container*,
+// assign_detail::default_type_tag, const R& r)
+// is internally passed to convert_range<>(), to allow, for example,
+// typedef std::map<int,int> map_;
+// typedef std::pair<const int,int> pair_;
+// map_ map1 = cref_csv( pair_(1,2), pair_(2,3) );
// April 15, 2010 chain_l(a)(b)(c) becomes a && b && c
// March 25, 2010
// in write_to_array, replaced
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-15 17:14:07 EDT (Tue, 15 Jun 2010)
@@ -2,6 +2,9 @@
// range.cpp //
// //
//////////////////////////////////////////////////////////////////////////////
+#include <utility>
+#include <map>
+
#include <ostream>
#include <iterator>
#include <vector>
@@ -9,6 +12,7 @@
#include <boost/typeof/typeof.hpp>
#include <boost/next_prior.hpp>
#include <boost/range/algorithm/copy.hpp>
+#include <boost/tuple/tuple.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>
@@ -95,8 +99,28 @@
BOOST_ASSERT( vec.size() == 5 );
}
+{
+ using namespace std;
+ typedef std::map<int,int> map_;
+ typedef std::pair<const int,int> pair_;
+ map_ map1 = cref_csv( pair_(1,2), pair_(2,3) );
+ BOOST_ASSERT( map1[1] == 2 );
+ BOOST_ASSERT( map1[2] == 3 );
+ BOOST_ASSERT( map1.size() == 2 );
+}
+{
+ typedef boost::tuple<int,std::string,int> tuple_;
-
+ std::vector<tuple_> v = cref_csv( tuple_(1, "foo", 2) , tuple_(3, "bar", 4) );
+ BOOST_ASSERT( v.size() == 2 );
+ BOOST_ASSERT( boost::get<0>( v[1] ) == 3 );
+}
+{
+ std::vector<int> vec = (list_of(1),2,3);
+ BOOST_ASSERT(vec[0]==1);
+ BOOST_ASSERT(vec[1]==2);
+ BOOST_ASSERT(vec[2]==3);
+}
os << "<- " << std::endl;
}
Modified: sandbox/statistics/support/libs/assign/src/main.cpp
==============================================================================
--- sandbox/statistics/support/libs/assign/src/main.cpp (original)
+++ sandbox/statistics/support/libs/assign/src/main.cpp 2010-06-15 17:14:07 EDT (Tue, 15 Jun 2010)
@@ -12,7 +12,6 @@
using namespace boost::assign::detail::auto_size;
void (*fp)();
-
{ // 1
fp = check_ref_list_of_example1<int>;
(*fp)();
@@ -134,7 +133,7 @@
fp = check_ref_csv_example2<int>;
(*fp)();
}
-
+
std::cout << "check_ref_csv : ok" << std::endl;
return 0;
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