|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69852 - in sandbox/assign_v2: boost/assign/v2/ref/array boost/assign/v2/utility/chain boost/assign/v2/utility/conversion libs/assign/v2/test libs/assign/v2/test/put libs/assign/v2/test/put/modifier libs/assign/v2/test/put/pipe libs/assign/v2/test/put/pipe/modifier libs/assign/v2/test/ref libs/assign/v2/test/utility
From: erwann.rogard_at_[hidden]
Date: 2011-03-11 12:16:10
Author: e_r
Date: 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
New Revision: 69852
URL: http://svn.boost.org/trac/boost/changeset/69852
Log:
upd assign_v2
Text files modified:
sandbox/assign_v2/boost/assign/v2/ref/array/array.hpp | 1
sandbox/assign_v2/boost/assign/v2/utility/chain/check.hpp | 2
sandbox/assign_v2/boost/assign/v2/utility/conversion/check.hpp | 2
sandbox/assign_v2/boost/assign/v2/utility/conversion/convert.hpp | 15 +++++++++
sandbox/assign_v2/boost/assign/v2/utility/conversion/converter.hpp | 18 +++++++++-
sandbox/assign_v2/libs/assign/v2/test/mix.cpp | 66 +++++++++++++++++++++++----------------
sandbox/assign_v2/libs/assign/v2/test/put/container.cpp | 50 ++++++++++++++++++------------
sandbox/assign_v2/libs/assign/v2/test/put/deduce.cpp | 8 ++++
sandbox/assign_v2/libs/assign/v2/test/put/deque.cpp | 3 +
sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp | 49 ++++++++---------------------
sandbox/assign_v2/libs/assign/v2/test/put/modifier/iterate.cpp | 35 ++++++++++----------
sandbox/assign_v2/libs/assign/v2/test/put/modifier/lookup.cpp | 13 ++++---
sandbox/assign_v2/libs/assign/v2/test/put/modifier/repeat.cpp | 6 +-
sandbox/assign_v2/libs/assign/v2/test/put/modifier/standard.cpp | 5 +-
sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.cpp | 9 +++--
sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.cpp | 42 ++++---------------------
sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/iterate.cpp | 13 ++++---
sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/lookup.cpp | 11 +++---
sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/repeat.cpp | 32 +++++++-----------
sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/standard.cpp | 9 +++--
sandbox/assign_v2/libs/assign/v2/test/put/pipe/put.cpp | 7 +---
sandbox/assign_v2/libs/assign/v2/test/ref/array.cpp | 9 +++--
sandbox/assign_v2/libs/assign/v2/test/ref/convert_traits.cpp | 7 +++
sandbox/assign_v2/libs/assign/v2/test/ref/csv_array.cpp | 9 +++--
sandbox/assign_v2/libs/assign/v2/test/ref/list.cpp | 41 +++++++++++++----------
sandbox/assign_v2/libs/assign/v2/test/ref/list_tuple.cpp | 4 ++
sandbox/assign_v2/libs/assign/v2/test/ref/wrapper.cpp | 10 +++---
sandbox/assign_v2/libs/assign/v2/test/utility/chain.cpp | 53 +++++++++++++++----------------
sandbox/assign_v2/libs/assign/v2/test/utility/conversion.cpp | 7 ++-
sandbox/assign_v2/libs/assign/v2/test/utility/csv.cpp | 32 ++++++++----------
30 files changed, 293 insertions(+), 275 deletions(-)
Modified: sandbox/assign_v2/boost/assign/v2/ref/array/array.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/array/array.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/ref/array/array.hpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -75,6 +75,7 @@
return array<T const>( v2::_nil )( t );
}
+
}// ref
}// v2
}// assign
Modified: sandbox/assign_v2/boost/assign/v2/utility/chain/check.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/chain/check.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/chain/check.hpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -109,7 +109,7 @@
template<typename T>
void exec()
{
- namespace as2 = boost::assign::v2;
+ namespace as2 = assign::v2;
typedef std::vector<T> vt_;
vt_ vt1( 2 ), vt2( 3 ), vt3( 3 );
vt_ vt;
Modified: sandbox/assign_v2/boost/assign/v2/utility/conversion/check.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/conversion/check.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/conversion/check.hpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -43,7 +43,7 @@
template<typename R>
void equal_convert(R const& r)
{
- namespace as2 = boost::assign::v2;
+ namespace as2 = assign::v2;
namespace ns = check_aux;
typedef boost::array<int, 8> ar_;
Modified: sandbox/assign_v2/boost/assign/v2/utility/conversion/convert.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/conversion/convert.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/conversion/convert.hpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -38,6 +38,15 @@
return convert_aux::convert<C>( r, tag_() );
}
+ template<typename C>
+ struct convert_adapter{};
+
+ template<typename R, typename C>
+ C operator|( R const& r, convert_adapter<C> )
+ {
+ return convert<C>( r );
+ }
+
}// convert_aux
using convert_aux::convert;
namespace result_of{
@@ -47,6 +56,12 @@
}//result_of
+template<typename C>
+convert_aux::convert_adapter<C> _convert()
+{
+ return convert_aux::convert_adapter<C>();
+}
+
}// v2
}// assign
}// boost
Modified: sandbox/assign_v2/boost/assign/v2/utility/conversion/converter.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/conversion/converter.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/conversion/converter.hpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -21,7 +21,7 @@
namespace convert_aux{
template<typename R>
- class adapter
+ class converter
{
typedef typename boost::add_const<R>::type const_;
@@ -32,7 +32,7 @@
public:
- explicit adapter(const_& r) : w( r ){}
+ explicit converter(const_& r) : w( r ){}
template<typename C>
operator C () const
@@ -51,13 +51,25 @@
};
+ struct converter_adapter{};
+
+ template<typename R>
+ converter<R> operator|( R const& r, converter_adapter )
+ {
+ return converter<R>( r );
+ }
+
}// convert_aux
+namespace{
+ convert_aux::converter_adapter const _converter
+ = convert_aux::converter_adapter();
+}
namespace result_of{
template<typename R>
struct converter
{
- typedef convert_aux::adapter<R> type;
+ typedef convert_aux::converter<R> type;
};
}//result_of
Modified: sandbox/assign_v2/libs/assign/v2/test/mix.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/mix.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/mix.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -7,9 +7,7 @@
// Boost Software License, Version 1.0. (See accompanying file //
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
//////////////////////////////////////////////////////////////////////////////
-#include <iostream>
-
-
+#include <bitset>
#include <cmath>
#include <list>
#include <vector>
@@ -31,6 +29,8 @@
#include <boost/assign/v2/utility/chain/alias.hpp>
#include <libs/assign/v2/test/mix.h>
+#include <iostream>
+
namespace test_assign_v2{
namespace xxx_mix{
@@ -38,34 +38,46 @@
void test(){
- namespace as2 = boost::assign::v2;
- namespace lambda = boost::lambda;
+ using namespace boost;
+ using namespace lambda;
+ namespace as2 = assign::v2;
{
// suggested by JB:
//[mix_stable_partition
std::deque<int> cont;
- boost::range::stable_partition(
+ range::stable_partition(
/*<< Calls `cont.push_back( t )` for [^t=0,...,5], and returns `cont` >>*/
cont | as2::_csv_put( 0, 1, 2, 3, 4, 5 ),
- lambda::_1 % 2
+ _1 % 2
);
- BOOST_ASSIGN_V2_CHECK(boost::range::equal(
+ BOOST_ASSIGN_V2_CHECK(range::equal(
cont,
/*<< [^1, 3, ..., 4] are held by reference (not copies) >>*/
as2::ref::csv_array(1, 3, 5, 0, 2, 4)
));
//]
}
+ {
+ //[mix_bitset_revisited
+ typedef std::string str_; typedef std::bitset<3> data_;
+ std::vector<data_> consecutive; as2::put( consecutive )( as2::as_arg_list( as2::csv_deque</*Explicit template argument `std::string` is required, because the deduced argument would be `const char*`, and only the former is a valid argument to `data_`'s constructor*/std::string>( "000", "001", "010", "011", "100", "101", "110", "111" ) ) );
+
+ for(int i = 0; i < consecutive.size(); i++)
+ {
+ BOOST_ASSIGN_V2_CHECK( consecutive[i].to_ulong() == i );
+ }
+ //]
+ }
{
//[mix_maxtrix3x3
const int sz = 3;
- typedef boost::array<int, sz> r_;
- boost::array<r_, sz> matrix3x3 = /*<<Using `converter`, here, is optional>>*/converter(
+ typedef array<int, sz> row_;
+ array<row_, sz> matrix3x3 = converter(
as2::ref::array
- ( converter( as2::ref::csv_array( 1, 2, 3 ) ).type<r_>() )
- ( converter( as2::ref::csv_array( 4, 5, 6 ) ).type<r_>() )
- ( converter( as2::ref::csv_array( 7, 8, 9 ) ).type<r_>() )
+ ( as2::ref::csv_array( 1, 2, 3 ) | as2::_convert<row_>() )
+ ( as2::ref::csv_array( 4, 5, 6 ) | as2::_convert<row_>() )
+ ( as2::ref::csv_array( 7, 8, 9 ) | as2::_convert<row_>() )
);
for(int i = 0; i < 9; i++)
{
@@ -74,13 +86,13 @@
//]
}
{
- //[mix_deque_csv_array
- typedef double elem_; typedef std::list<elem_> r_; typedef std::vector<r_> ragged_;
+ //[mix_ragged
+ typedef double data_; typedef std::list<data_> variable_size_; typedef std::vector<variable_size_> ragged_;
- ragged_ ragged = /*<<Using `converter` is a good practice, bearing in mind it may work without it>>*/converter(
- as2::deque<r_>
- ( converter( as2::ref::csv_array( 0.71, 0.63, 0.85 ) ).type<r_>() )
- ( converter( as2::ref::csv_array( 0.61, 0.69, 0.92, 0.55 ) ).type<r_>() )
+ ragged_ ragged = converter(
+ as2::deque<variable_size_>
+ ( as2::ref::csv_array( 0.71, 0.63, 0.85 ) | as2::_convert<variable_size_>() )
+ ( as2::ref::csv_array( 0.61, 0.69, 0.92, 0.55 ) | as2::_convert<variable_size_>() )
( 1, -99.99 )
( )
);
@@ -90,7 +102,7 @@
BOOST_ASSIGN_V2_CHECK( ragged[2].size() == 1 );
BOOST_ASSIGN_V2_CHECK( ragged[3].size() == 0 );
//]
- elem_ eps = boost::numeric::bounds<elem_>::smallest();
+ data_ eps = numeric::bounds<data_>::smallest();
BOOST_ASSIGN_V2_CHECK( fabs( ragged.front().front() - 0.71 ) < eps );
BOOST_ASSIGN_V2_CHECK( fabs( ragged.front().back() - 0.85 ) < eps );
BOOST_ASSIGN_V2_CHECK( fabs( ragged[2].front() + 99.99 ) < eps );
@@ -98,11 +110,11 @@
}
{
- //[iterate
- typedef int T; boost::array<T, 5> powers; powers[0] = 1; powers[1] = 10;
+ //[mix_fun_iterate
+ typedef int T; array<T, 5> powers; powers[0] = 1; powers[1] = 10;
int i = 2, k = powers[ i - 1 ];
/*<<Calls `powers[i] = ( k *= 10 )` for [^ i = 2, 3, 4 ] >>*/
- ( as2::put( powers ) % ( as2::_fun = lambda::var( k ) *= 10 ) % ( as2::_iterate = lambda::var( i )++ ) )()()();
+ ( as2::put( powers ) % ( as2::_fun = var( k ) *= 10 ) % ( as2::_iterate = var( i )++ ) )()()();
BOOST_ASSIGN_V2_CHECK( powers[0] == 1 );
BOOST_ASSIGN_V2_CHECK( powers[1] == 10 );
@@ -114,14 +126,14 @@
{
//[deque_chain_put
typedef const char state_ [3]; state_ ct = "CT", nj = "NJ", ny = "NY", ca = "CA", /* ore = "OR",*/ wa = "WA";
- typedef int code_; typedef boost::tuple<state_/*<<Notice the reference>>*/&, code_> area_code_;
- /*<<Brings && for chaining into scope>>*/using namespace boost::assign::v2;
+ typedef int code_; typedef tuple<state_/*<<Notice the reference>>*/&, code_> area_code_;
+ /*<<Brings && for chaining into scope>>*/using namespace assign::v2;
std::deque<area_code_> pacific;
- //boost::copy(
+ //copy(
as2::deque<area_code_>( nj, 201 )( ct, 203 )( ny, 212 )( ny, 315 )( ny, 347 )( nj, 551 )
&& ( pacific | as2::_put( wa, 206 )( ca, 209 )( ca, 213 )( wa, 253 ) );//,
- //std::cout << boost::get<1>( lambda::_1 ) << std::endl;
+ //std::cout << get<1>( _1 ) << std::endl;
//);
//]
Modified: sandbox/assign_v2/libs/assign/v2/test/put/container.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/container.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/container.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -14,12 +14,14 @@
#include <map>
#include <list>
#include <queue>
+#include <set>
#include <stack>
#include <string>
#include <utility>
#include <boost/assign/v2/detail/config/check.hpp>
#include <boost/assign/v2/detail/functor/identity.hpp>
#include <boost/assign/v2/put/container/put.hpp>
+#include <boost/assign/v2/put/deque/csv_deque.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/range/algorithm_ext/iota.hpp>
#include <boost/range/begin.hpp>
@@ -36,12 +38,13 @@
void test(){
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
{
//[put_bitset
- typedef std::string str_; typedef /*<<`data_( "011" )`, for instance, is not valid, but `data_( str_( "011" ) )` is valid (GCC 4.2)>>*/ std::bitset<3> data_;
- /*<<Neither `consecutive.push_back( "011" )`, nor `consecutive.push_back( str_( "011" ) )`, for instance, are valid, but `consecutive.push_back( data_( str_( "011" ) ) );` is valid (GCC4.2)>>*/ std::vector<data_> consecutive; /*<<Calls `consecutive.push_back( data_( t ) );` for [^t = str_( "000" ), str_( "001" ), str_( "010" ), str_( "011" ), str_( "100" ), str_( "101" ), str_( "110" ), str_( "111" )]`>>*/as2::put( consecutive )( str_( "000" ) )( str_( "001" ) )( str_( "010" ) )( str_( "011" ) )( str_( "100" ) )( str_( "101" ) )( str_( "110" ) )( str_( "111" ) );
+ typedef std::string str_; typedef std::bitset<3> data_;
+ /*<<Keep in mind that although `data_( str_( "011" ) )`, for instance, is valid, `consecutive.push_back( str_( "011" ) )` isn't (GCC4.2)>>*/ std::vector<data_> consecutive; /*<<Calls `consecutive.push_back( data_( t ) );` for [^t = str_( "000" ), ..., str_( "111" )]`>>*/as2::put( consecutive )( str_( "000" ) )( str_( "001" ) )( str_( "010" ) )( str_( "011" ) )( str_( "100" ) )( str_( "101" ) )( str_( "110" ) )( str_( "111" ) );
for(int i = 0; i < consecutive.size(); i++)
{
@@ -51,26 +54,26 @@
}
{
//[put_as_arg_list
- std::vector<int> numeric( 10 ); boost::iota( numeric, 0 ); typedef std::string str_;
- typedef boost::variant< int, str_ > data_; boost::array<data_, 10 + 4> numeric_kb;
- as2::put( numeric_kb )/*<<Calls `numeric_kb[0] = "+"`>>*/( "+" )/*<<Calls `numeric_kb[1] = "-"`>>*/( "-" )/*<<Calls `numeric_kb[2] = "*"`>>*/( "*" )/*<<Calls `numeric_kb[3] = "/"`>>*/( "/" )/*<<Equivalent to calling `( *( boost::begin( numeric ) ) )( *( 1 + boost::begin( numeric ) ) )`[^...]`( *( 9 + boost::begin( numeric ) ) )`>>*/( as2::as_arg_list( numeric ) );
+ std::vector<int> numeric( 10 ); iota( numeric, 0 ); typedef std::string str_;
+ typedef variant< int, str_ > data_; array<data_, 10 + 4> numeric_kb;
+ as2::put( numeric_kb )/*<<The next 6 calls have the following side effect `numeric_kb[i] = t` for [^( i, t ) = ( 0, "+" ), ( 1, "-" ), ( 2, "*" ), ( 3, "/" ), ( 4, "=" ), ( 5, "." )]>>*/( "+" )( "-" )( "*" )( "/" )( "=" )( "." )/*<<Equivalent to calling `( *( i + begin( numeric ) ) )` for [^i = 0, ..., size( numeric ) - 1]>>*/( as2::as_arg_list( numeric ) );
using namespace boost;
BOOST_ASSIGN_V2_CHECK( get<str_>( numeric_kb[ 0 ] ) == "+" );
- BOOST_ASSIGN_V2_CHECK( get<str_>( numeric_kb[ 3 ] ) == "/" );
+ BOOST_ASSIGN_V2_CHECK( get<str_>( numeric_kb[ 5 ] ) == "." );
for(int i = 0; i< numeric.size(); i++){
BOOST_ASSIGN_V2_CHECK( get<int>( numeric_kb[ i + 4 ] ) == i );
}
//]
}
{
- //[put_variable_args_size
+ //[put_variable_size
typedef double data_; typedef std::vector<data_> variable_size_;
variable_size_ a( 3 ); a[0] = 0.71; a[1] = 0.63; a[2] = 0.85;
- variable_size_ b; as2::put( b )( 0.61 )( 0.69 )( 0.92 )( 0.55 );
- boost::array<variable_size_, 4> ragged;
+ variable_size_ b( 4 ); b[0] = 0.61; b[1] = 0.69; b[2] = 0.92; b[3] = 0.55;
+ array<variable_size_, 4> ragged;
as2::put( ragged )
- /*<<Calls `ragged.push_back( variable_size_( boost::begin( a ), boost::end( a ) ) )`>>*/( boost::begin( a ), boost::end( a ) )
+ /*<<Calls `ragged.push_back( variable_size_( begin( a ), end( a ) ) )`>>*/( begin( a ), end( a ) )
/*<<Calls `ragged.push_back( variable_size_( b ) )`>>*/( b )
/*<<Calls `ragged.push_back( variable_size_( 1, -99.99 ) )`>>*/( 1, -99.99 )
/*<<Calls `ragged.push_back( variable_size_( ) )`>>*/( );
@@ -80,7 +83,7 @@
BOOST_ASSIGN_V2_CHECK( ragged[2].size() == 1 );
BOOST_ASSIGN_V2_CHECK( ragged[3].size() == 0 );
//]
- data_ eps = boost::numeric::bounds<data_>::smallest();
+ data_ eps = numeric::bounds<data_>::smallest();
BOOST_ASSIGN_V2_CHECK( fabs( ragged[0].front() - a.front() ) < eps );
BOOST_ASSIGN_V2_CHECK( fabs( ragged[0].back() - a.back() ) < eps );
BOOST_ASSIGN_V2_CHECK( fabs( ragged[1].front() - b.front() ) < eps );
@@ -89,19 +92,26 @@
BOOST_ASSIGN_V2_CHECK( fabs( ragged[2].back() + 99.99 ) < eps );
}
{
- //[put_adapter
- std::queue<int> fifo; /*<<Calls `fifo.push( t )` for [^t = 72, 31, 48]>>*/as2::put( fifo )( 72 )( 31 )( 48 );
-
- BOOST_ASSIGN_V2_CHECK( fifo.front() == 72 );
- BOOST_ASSIGN_V2_CHECK( fifo.back() == 48 );
- //]
+ //[put_deduce
+ std::queue<int> adapter; /*<<Calls `fifo.push( t )` for [^t = 72, 31, 48]>>*/as2::put( adapter )( 72 )( 31 )( 48 );
+ array<int, 3> array; /*<<Calls `array[i] = t` for [^( i, t ) = ( 0, 72 ), ( 1, 31 ), ( 2, 48 )]>>*/as2::put( array )( 72 )( 31 )( 48 );
+ std::set<int> assoc; /*<<Calls `assoc.insert( t )` for [^t = 72, 31, 48]>>*/as2::put( assoc )( 72 )( 31 )( 48 );
+ std::list<int> seq; /*<<Calls `seq.push_back( t )` for [^t = 72, 31, 48]>>*/as2::put( seq )( 72 )( 31 )( 48 );
+ //]
+ BOOST_ASSIGN_V2_CHECK( adapter.front() == 72 );
+ BOOST_ASSIGN_V2_CHECK( adapter.back() == 48 );
+ BOOST_ASSIGN_V2_CHECK( array.front() == 72 );
+ BOOST_ASSIGN_V2_CHECK( array.back() == 48 );
+ BOOST_ASSIGN_V2_CHECK( assoc.count( 48 ) == 1 );
+ BOOST_ASSIGN_V2_CHECK( assoc.count( 72 ) == 71 );
+ BOOST_ASSIGN_V2_CHECK( seq.front() == 72 );
+ BOOST_ASSIGN_V2_CHECK( seq.back() == 48 );
}
{
- using namespace boost;
// http://bioinfo.mbb.yale.edu/~mbg/dom/fun3/area-codes/
//[put_seq_tuple_ref
typedef const char us_state_ [3]; us_state_ ct = "CT", nj = "NJ", ny = "NY";
- typedef int area_code_; typedef boost::tuple<us_state_/*<<Notice the reference>>*/&, area_code_> data_;
+ typedef int area_code_; typedef tuple<us_state_/*<<Notice the reference>>*/&, area_code_> data_;
std::deque< data_ > tri_state_area; /*Calls `tri_state.push_back( data_( s, c ) )` for [^( s, c ) = ( ny, 212 )( ny, 718 )( ny, 516 )( ny, 914 )( nj, 210 )( nj, 908 )( nj, 609 )( ct, 203 ) ]*/
as2::put( tri_state_area )( ny, 212 )( ny, 718 )( ny, 516 )( ny, 914 )( nj, 210 )( nj, 908 )( nj, 609 )( ct, 203 );
Modified: sandbox/assign_v2/libs/assign/v2/test/put/deduce.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/deduce.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/deduce.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -30,9 +30,15 @@
namespace xxx_put{
namespace xxx_deduce{
+ // --User may skip this file-- //
+ // It checks internal details. //
+ // --------------------------- //
+
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
+
{
typedef as2::modifier_tag::push_back answer_;
as2::put_aux::check_deduce<std::deque<int>, answer_>();
Modified: sandbox/assign_v2/libs/assign/v2/test/put/deque.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/deque.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/deque.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -22,7 +22,8 @@
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
{
// http://bioinfo.mbb.yale.edu/~mbg/dom/fun3/area-codes/
//[deque_tuple_ref
Modified: sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -7,14 +7,13 @@
// Boost Software License, Version 1.0. (See accompanying file //
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
//////////////////////////////////////////////////////////////////////////////
-#include <bitset>
#include <cmath> // MSVC #include <math.h>
#include <deque>
#include <list>
#include <vector>
#include <boost/array.hpp>
#include <boost/assign/v2/detail/config/check.hpp>
-#include <boost/assign/v2/put/container.hpp>
+#include <boost/assign/v2/put/container/put.hpp>
#include <boost/assign/v2/put/deque.hpp>
#include <boost/assign/v2/put/modulo/fun.hpp>
#include <boost/function.hpp>
@@ -23,7 +22,6 @@
#include <boost/lambda/construct.hpp>
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/typeof/typeof.hpp>
-#include <boost/spirit/home/phoenix.hpp>
#include <libs/assign/v2/test/put/fun.h>
#include <boost/lexical_cast.hpp>
@@ -45,15 +43,15 @@
void test()
{
- namespace as2 = boost::assign::v2;
+ namespace as2 = assign::v2;
{
- std::vector<int> incr_fact;
+ std::vector<int> incr;
(
- as2::put( cont ) % ( as2::_fun = f() )
- )( 1 )( 2 )( 6 )( 24 )( 120 );
+ as2::put( incr ) % ( as2::_fun = f() )
+ )( 1 )( 2 )( 3 )( 4 )( 5 );
- BOOST_ASSIGN_V2_CHECK( incr_fact.front() == ( 2 ) );
- BOOST_ASSIGN_V2_CHECK( incr_fact.back() == ( 121 ) );
+ BOOST_ASSIGN_V2_CHECK( incr.front() == ( 2 ) );
+ BOOST_ASSIGN_V2_CHECK( incr.back() == ( 6 ) );
// TODO fix Bug :
// LLVM 1.5 - Release mode, EXC_BAD_ACCESS, stl_vector.h #602
}
@@ -64,49 +62,30 @@
void test()
{
- namespace as2 = boost::assign::v2;
- namespace lambda = boost::lambda;
+ using namespace boost;
+ using namespace lambda;
+ namespace as2 = assign::v2;
{
//[modulo_fun_math
std::vector<double> exponent;
- typedef boost::function<double(double)> f_;
+ typedef function<double(double)> f_;
(
as2::put( exponent ) % ( as2::_fun = f_( log10 ) )
- )( 1000.0 )( 10.0 )( 10000.0 )( 1.0 )( 100.0 );
+ )/*<<Calls `exponent.push_back( log10( 1000.0 ) )`>>*/( 1000.0 )( 10.0 )( 10000.0 )( 1.0 )( 100.0 );
- double eps = boost::numeric::bounds<double>::smallest();
+ double eps = numeric::bounds<double>::smallest();
BOOST_ASSIGN_V2_CHECK( fabs( exponent.front() - 3.0 ) < eps );
BOOST_ASSIGN_V2_CHECK( fabs( exponent.back() - 2.0 ) < eps );
//]
}
{
- //[modulo_fun_char
- int i = 65; std::cout << " static_cast<char>( i ) = " << static_cast<char>( i ) << std::endl;
-
- //]
- }
- {
- // TODO easier way? deque
- //[modulo_fun_bitset
- typedef std::bitset<3> data_; typedef const char str_lit_ [4]; /*<<`data_( "011" )`, for instance, is not valid, but `data_( str_( "011" ) )` is valid (GCC 4.2)>>*/typedef std::string str_;
- /*<<Neither `consecutive[i] = ( "011" )`, nor `consecutive[i] = str_( "011" ) )`, for instance, are valid, but `consecutive[i] = ( data_( str_( "011" ) ) );` is valid (GCC4.2)>>*/boost::array<data_, 8> consecutive;
- typedef lambda::constructor<data_> f_; typedef lambda::constructor<str_> g_; BOOST_AUTO( f_of_g, lambda::bind( f_(), lambda::bind( g_(), lambda::_1 ) ) );
- ( as2::put( consecutive ) % ( as2::_fun = f_of_g ) )( "000" )( "001" )( "010" )( "011" )( "100" )( "101" )( "110" )( "111" );
-
- for(int i = 0; i < consecutive.size(); i++)
- {
- BOOST_ASSIGN_V2_CHECK( consecutive[i].to_ulong() == i );
- }
- //]
- }
- {
//[modulo_fun_deque
int i = 1, k = 1;
BOOST_AUTO(
factorials, (
as2::deque<int>( as2::_nil ) % (
- as2::_fun = ( lambda::var(k) *= ( lambda::var(i)++ ) )
+ as2::_fun = ( var(k) *= ( var(i)++ ) )
)
)()()()()()
);
Modified: sandbox/assign_v2/libs/assign/v2/test/put/modifier/iterate.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/modifier/iterate.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/modifier/iterate.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -32,33 +32,34 @@
void test()
{
- namespace as2 = boost::assign::v2;
- namespace lambda = boost::lambda;
+ using namespace boost;
+ using namespace lambda;
+ namespace as2 = assign::v2;
{
//[iterate_meta
typedef as2::put_aux::keyword_iterate keyword_;
typedef as2::modifier_tag::iterate_arg arg_;
typedef as2::put_aux::modulo_modifier<keyword_, arg_> modulo_;
- typedef boost::array<int, 4> cont_;
+ typedef array<int, 4> cont_;
typedef as2::result_of::put<cont_>::type put_;
typedef as2::result_of::modulo_modifier<put_> meta1_;
typedef ::boost::mpl::apply2<meta1_, keyword_, arg_>::type result1_;
typedef as2::modifier_tag::iterate<arg_> tag1_;
typedef as2::put_aux::replace_modifier_tag<put_> meta2_;
typedef ::boost::mpl::apply1<meta2_, tag1_>::type result2_;
- BOOST_MPL_ASSERT((boost::is_same<result1_, result2_>));
+ BOOST_MPL_ASSERT((is_same<result1_, result2_>));
//]
}
{
//[iterate
- typedef int T; boost::array<T, 4> consecutive_powers; consecutive_powers[0] = 1; consecutive_powers[1] = 10;
- int i = 2; ( as2::put( consecutive_powers ) % ( as2::_iterate = lambda::var( i )++ ) )( 100 )( 1000 );
+ typedef int T; array<T, 4> powers; powers[0] = 1; powers[1] = 10;
+ int i = 2; ( as2::put( powers ) % ( as2::_iterate = var( i )++ ) )( 100 )( 1000 );
- BOOST_ASSIGN_V2_CHECK( consecutive_powers[0] == 1 );
- BOOST_ASSIGN_V2_CHECK( consecutive_powers[1] == 10 );
- BOOST_ASSIGN_V2_CHECK( consecutive_powers[2] == 100 );
- BOOST_ASSIGN_V2_CHECK( consecutive_powers[3] == 1000 );
+ BOOST_ASSIGN_V2_CHECK( powers[0] == 1 );
+ BOOST_ASSIGN_V2_CHECK( powers[1] == 10 );
+ BOOST_ASSIGN_V2_CHECK( powers[2] == 100 );
+ BOOST_ASSIGN_V2_CHECK( powers[3] == 1000 );
//]
}
{
@@ -72,7 +73,7 @@
typedef as2::modifier_tag::iterate<arg_> tag1_;
typedef as2::put_aux::replace_modifier_tag<put_> meta2_;
typedef ::boost::mpl::apply1<meta2_, tag1_>::type result2_;
- BOOST_MPL_ASSERT((boost::is_same<result1_, result2_>));
+ BOOST_MPL_ASSERT((is_same<result1_, result2_>));
//]
}
{
@@ -81,14 +82,14 @@
int i = 2;
BOOST_AUTO(
- consecutive_powers,
- ( missing_tail % ( as2::_iterate = lambda::var( i )++ ) )( 100 )( 1000 )
+ powers,
+ ( missing_tail % ( as2::_iterate = var( i )++ ) )( 100 )( 1000 )
);
- BOOST_ASSIGN_V2_CHECK( consecutive_powers[0] == 1 );
- BOOST_ASSIGN_V2_CHECK( consecutive_powers[1] == 10 );
- BOOST_ASSIGN_V2_CHECK( consecutive_powers[2] == 100 );
- BOOST_ASSIGN_V2_CHECK( consecutive_powers[3] == 1000 );
+ BOOST_ASSIGN_V2_CHECK( powers[0] == 1 );
+ BOOST_ASSIGN_V2_CHECK( powers[1] == 10 );
+ BOOST_ASSIGN_V2_CHECK( powers[2] == 100 );
+ BOOST_ASSIGN_V2_CHECK( powers[3] == 1000 );
//]
}
}
Modified: sandbox/assign_v2/libs/assign/v2/test/put/modifier/lookup.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/modifier/lookup.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/modifier/lookup.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -31,11 +31,12 @@
void test()
{
- namespace as2 = boost::assign::v2;
- namespace lambda = boost::lambda;
+ using namespace boost;
+ using namespace lambda;
+ namespace as2 = assign::v2;
{
//[lookup_meta
- typedef BOOST_TYPEOF(lambda::_1) arg_;
+ typedef BOOST_TYPEOF(_1) arg_;
typedef as2::put_aux::keyword_lookup keyword_;
typedef as2::put_aux::modulo_modifier<keyword_, arg_> modulo_;
typedef std::map<std::string, int> cont_;
@@ -52,7 +53,7 @@
//[lookup
typedef std::map<std::string, int> C; C cal;
(
- as2::put( cal )/*<<Calls `cal.insert( C::value_type( "feb", 28 ) )`>>*/( "feb", 28 )( "apr", 30 )( "jun", 30 )( "sep", 30 )( "nov", 30 )/*<<Without this parameter, the compiler would complain that the subsequent argument (`"jan"`) is not convertible to `C::key_type`>>*/% ( as2::_fun = lambda::_1 ) % ( as2::_lookup = (lambda::_1 = 31) )
+ as2::put( cal )/*<<Calls `cal.insert( C::value_type( "feb", 28 ) )`>>*/( "feb", 28 )( "apr", 30 )( "jun", 30 )( "sep", 30 )( "nov", 30 )/*<<Without this parameter, the compiler would complain that the subsequent argument (`"jan"`) is not convertible to `C::key_type`>>*/% ( as2::_fun = _1 ) % ( as2::_lookup = (_1 = 31) )
)/*<<Calls `cal["jan"] = 31`>>*/( "jan" )( "mar" )( "may" )( "jul" )( "aug" )( "oct" )( "dec" );
BOOST_ASSIGN_V2_CHECK( cal["jan"] == 31 );
@@ -61,7 +62,7 @@
}
{
//[lookup_meta_deque
- typedef BOOST_TYPEOF(lambda::_1) arg_;
+ typedef BOOST_TYPEOF(_1) arg_;
typedef as2::put_aux::keyword_lookup keyword_;
typedef as2::put_aux::modulo_modifier<keyword_, arg_> modulo_;
typedef as2::result_of::deque<int>::type put_;
@@ -78,7 +79,7 @@
BOOST_AUTO(
days_in_first_quater,
(
- as2::deque<int>( 31 )( 31 )( 31 ) % ( as2::_lookup = ( lambda::_1 -= 3 ) )
+ as2::deque<int>( 31 )( 31 )( 31 ) % ( as2::_lookup = ( _1 -= 3 ) )
)( 1 )
);
BOOST_ASSIGN_V2_CHECK( days_in_first_quater[0] == 31 );
Modified: sandbox/assign_v2/libs/assign/v2/test/put/modifier/repeat.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/modifier/repeat.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/modifier/repeat.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -23,8 +23,8 @@
void test()
{
-
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
{
//[repeat_simple
std::vector<int> cont;
@@ -39,7 +39,7 @@
//[repeat_compose_deque
BOOST_AUTO(
cont, (
- /*<<Notice that `_repeat` can be combined with another modifier, `_push_front`, in this case>>*/as2::deque<int>( as2::_nil ) % as2::_push_front % ( as2::_repeat = 2 )
+ as2::deque<int>( as2::_nil ) % as2::_push_front % ( as2::_repeat = 2 )
)( 72 )( 31 )( 48 )
);
BOOST_ASSIGN_V2_CHECK( boost::size( cont ) == 6 );
Modified: sandbox/assign_v2/libs/assign/v2/test/put/modifier/standard.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/modifier/standard.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/modifier/standard.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -34,11 +34,12 @@
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
// ------------------------------ WARNING ---------------------------- //
// Don't misconstrue the commands in the tests below as *necessary* to //
- // obtain particular implementation. Most of the time the default is //
+ // obtain particular implementation. In most cases, the default is //
// already set at that invoked with operator% //
// ------------------------------------------------------------------- //
Modified: sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -22,13 +22,14 @@
namespace xxx_pipe{
namespace xxx_args_list{
- // -----User may skip this file----- //
- // It checks internal details. //
- // --------------------------------- //
+ // --User may skip this file-- //
+ // It checks internal details. //
+ // --------------------------- //
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
typedef boost::mpl::int_<0> zero_;
{
typedef as2::put_pipe_aux::args_list<> args_list_;
Modified: sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -11,14 +11,10 @@
#include <list>
#include <vector>
#include <boost/assign/v2/detail/config/check.hpp>
-#include <boost/assign/v2/put/deque.hpp>
+#include <boost/assign/v2/put/deque/csv_deque.hpp>
#include <boost/assign/v2/put/modulo/fun.hpp>
#include <boost/assign/v2/put/pipe/put.hpp>
-#include <boost/assign/v2/put/pipe/csv_put.hpp>
-#include <boost/function.hpp>
-#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
-#include <boost/numeric/conversion/bounds.hpp>
#include <boost/range/algorithm/equal.hpp>
#include <libs/assign/v2/test/put/pipe/fun.h>
@@ -34,41 +30,17 @@
void test()
{
- namespace as2 = boost::assign::v2;
- namespace lambda = boost::lambda;
- {
- //[pipe_modulo_fun_math
- std::vector<double> exponent;
- typedef boost::function<double(double)> f1_;
- typedef boost::function<double(double, double)> f2_;
- typedef boost::function<bool(double)> g1_;
- typedef boost::function<bool(double, double)> g2_;
- double eps = boost::numeric::bounds<double>::smallest();
- f2_ f2 = lambda::bind( f1_( fabs ), lambda::_1 - lambda::_2 ) ;
- g1_ g1 = ( eps > lambda::_1 );
- g2_ g2 = lambda::bind( g1, lambda::bind( f2, lambda::_1, lambda::_2 ) );
- //<-
- BOOST_ASSERT( g2( 0.0, 0 * eps ) );
- BOOST_ASSERT( !g2( 0.0, eps ) );
- BOOST_ASSERT( !g2( 0.0, - eps ) );
- //<-
- BOOST_ASSIGN_V2_CHECK(
- boost::range::equal(
- exponent | ( as2::_put % ( as2::_fun = f1_( log10 ) ) )( 1000.0 )( 10.0 )( 10000.0 )( 1.0 )( 100.0 ),
- as2::csv_deque<double>( 3.0, 1.0, 4.0, 0.0, 2.0 ),
- g2
- )
- );
- //]
- }
+ using namespace boost;
+ using namespace lambda;
+ namespace as2 = assign::v2;
{
//[csv_pipe_modulo_fun_math
int i = 0, k = 1; std::list<int> factorials;
BOOST_ASSIGN_V2_CHECK(
- boost::range::equal(
+ range::equal(
factorials | (
- as2::_put % ( as2::_fun = ( lambda::var(k) *= ( ++lambda::var(i) ) ) )
- )()()()()(),
+ as2::_put % ( as2::_fun = ( var(k) *= ( ++var(i) ) ) )
+ )/*Equivalent to calling `factorials.push_back( k *= ++i )`*/()()()()(),
as2::csv_deque<int>( 1 )( 2 )( 6 )( 24 )( 120 )
)
);
Modified: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/iterate.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/iterate.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/iterate.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -7,13 +7,12 @@
// Boost Software License, Version 1.0. (See accompanying file //
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
//////////////////////////////////////////////////////////////////////////////
-#include <boost/array.hpp>
-#include <boost/lambda/lambda.hpp>
-
#include <boost/assign/v2/detail/config/check.hpp>
#include <boost/assign/v2/put/modifier/iterate.hpp>
#include <boost/assign/v2/put/pipe/csv_put.hpp>
#include <boost/assign/v2/put/deque/csv_deque.hpp>
+#include <boost/array.hpp>
+#include <boost/lambda/lambda.hpp>
#include <libs/assign/v2/test/put/pipe/modifier/iterate.h>
namespace test_assign_v2{
@@ -24,8 +23,10 @@
void test()
{
- namespace as2 = boost::assign::v2;
- namespace lambda = boost::lambda;
+ using namespace boost;
+ using namespace lambda;
+ namespace as2 = assign::v2;
+
{
//[pipe_iterate
@@ -33,7 +34,7 @@
int i = 2;
BOOST_ASSIGN_V2_CHECK(
boost::range::equal(
- powers | ( as2::_csv_put % ( as2::_iterate = lambda::var( i )++ ) )( 100, 1000 ),
+ powers | ( as2::_csv_put % ( as2::_iterate = var( i )++ ) )( 100, 1000 ),
as2::csv_deque<T>( 1, 10, 100, 1000 )
)
);
Modified: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/lookup.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/lookup.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/lookup.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -27,18 +27,19 @@
void test()
{
- namespace as2 = boost::assign::v2;
- namespace lambda = boost::lambda;
+ using namespace boost;
+ using namespace lambda;
+ namespace as2 = assign::v2;
{
//[pipe_lookup
std::map<std::string, int> cal;
- BOOST_AUTO( _local, ( as2::_fun = lambda::_1 ) );
+ BOOST_AUTO( _local, ( as2::_fun = _1 ) );
BOOST_ASSIGN_V2_CHECK(
(
cal
| as2::_put( "feb", 28 )
- | ( as2::_csv_put % _local % ( as2::_lookup = (lambda::_1 = 30) ) )( "apr", "jun", "sep", "nov" )
- | ( as2::_csv_put % _local % ( as2::_lookup = (lambda::_1 = 31) ) )( "jan", "mar", "may", "jul", "aug", "oct", "dec" )
+ | ( as2::_csv_put % _local % ( as2::_lookup = (_1 = 30) ) )( "apr", "jun", "sep", "nov" )
+ | ( as2::_csv_put % _local % ( as2::_lookup = (_1 = 31) ) )( "jan", "mar", "may", "jul", "aug", "oct", "dec" )
)["feb"] == 28
);
Modified: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/repeat.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/repeat.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/repeat.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -8,10 +8,10 @@
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
//////////////////////////////////////////////////////////////////////////////
#include <vector>
-//#include <boost/assign/v2/detail/config/check.hpp>
-//#include <boost/assign/v2/put/modifier/repeat.hpp>
-//#include <boost/assign/v2/put/pipe/put.hpp>
-//#include <boost/assign/v2/put/deque.hpp>
+#include <boost/assign/v2/detail/config/check.hpp>
+#include <boost/assign/v2/put/modifier/repeat.hpp>
+#include <boost/assign/v2/put/pipe/put.hpp>
+#include <boost/assign/v2/put/deque.hpp>
#include <boost/range/algorithm/equal.hpp>
#include <libs/assign/v2/test/put/pipe/modifier/repeat.h>
@@ -24,23 +24,17 @@
void test()
{
- // namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
{
- //[repeat
+ //[pipe_repeat
std::vector<int> cont;
- //boost::range::equal(
- // cont | ( as2::_put % ( as2::_repeat = 2 ) )( 72 )( 31 )( 48 ),
- boost::range::equal(
- cont,
- cont
- );
- //);
-// BOOST_ASSIGN_V2_CHECK(
-// boost::range::equal(
-// cont | ( as2::_put % ( as2::_repeat = 2 ) )( 72 )( 31 )( 48 ),
-// as2::csv_deque<int>( 72, 72, 31, 31, 48, 48 )
-// )
-// );
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal(
+ cont | ( as2::_put % ( as2::_repeat = 2 ) )( 72 )( 31 )( 48 ),
+ as2::csv_deque<int>( 72, 72, 31, 31, 48, 48 )
+ )
+ );
//]
}
}
Modified: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/standard.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/standard.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modifier/standard.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -29,7 +29,8 @@
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
// ------------------------------ WARNING ---------------------------- //
// Don't misconstrue the commands in the tests below as *necessary* to //
@@ -60,12 +61,12 @@
{
//[pipe_modifier_insert
typedef std::set<double> doubles_; doubles_ sqrt2;
- boost::range_iterator<doubles_>::type lower = (
+ range_iterator<doubles_>::type lower = (
sqrt2 | ( as2::_put % as2::_insert )( 1.414 )( 1.41421 )( 1.41 )( 1.4142 )
).lower_bound( 1.41 );
- BOOST_ASSIGN_V2_CHECK( lower == boost::begin( sqrt2 ) );
- BOOST_ASSIGN_V2_CHECK( sqrt2.upper_bound( 1.41421 ) == boost::end( sqrt2 ) );
+ BOOST_ASSIGN_V2_CHECK( lower == begin( sqrt2 ) );
+ BOOST_ASSIGN_V2_CHECK( sqrt2.upper_bound( 1.41421 ) == end( sqrt2 ) );
//]
}
}
Modified: sandbox/assign_v2/libs/assign/v2/test/put/pipe/put.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/pipe/put.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/put.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -13,9 +13,6 @@
#include <list>
#include <string>
#include <boost/array.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/construct.hpp>
-#include <boost/numeric/conversion/bounds.hpp>
#include <boost/assign/v2/detail/config/check.hpp>
#include <boost/assign/v2/put/deque/csv_deque.hpp>
#include <boost/assign/v2/put/pipe/put.hpp>
@@ -30,8 +27,8 @@
namespace xxx_put{
void test(){
- namespace as2 = boost::assign::v2;
- namespace lambda = boost::lambda;
+ using namespace boost;
+ namespace as2 = assign::v2;
{
//pipe_put_str_literal
typedef const char* T; typedef std::string str_; std::deque<T> cont;
Modified: sandbox/assign_v2/libs/assign/v2/test/ref/array.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/ref/array.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/ref/array.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -23,7 +23,8 @@
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
{
//[ref_array_r
typedef int const T;
@@ -44,8 +45,8 @@
}
//]
{
- T& a = ( *boost::begin( ar4 ) );
- T& b = *boost::next( boost::begin( ar4 ), ar4.size() - 1 );
+ T& a = ( *begin( ar4 ) );
+ T& b = *next( begin( ar4 ), ar4.size() - 1 );
BOOST_ASSIGN_V2_CHECK( &a == &w );
BOOST_ASSIGN_V2_CHECK( &b == &z );
@@ -55,7 +56,7 @@
//[ref_array_w
typedef int T; T x, y, z;
std::vector<T> r( 3 ); r[0] = 72; r[1] = 31; r[2] = 48;
- boost::copy( r, boost::begin(
+ boost::copy( r, begin(
as2::ref::array( x )( y )( z ) | as2::ref::_get
)
);
Modified: sandbox/assign_v2/libs/assign/v2/test/ref/convert_traits.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/ref/convert_traits.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/ref/convert_traits.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -14,9 +14,14 @@
namespace xxx_ref{
namespace xxx_convert_traits{
+ // --User may skip this file-- //
+ // It checks internal details. //
+ // --------------------------- //
+
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
namespace ns = as2::ref::convert_traits::checking;
{
ns::same_value_type::do_check<int>();
Modified: sandbox/assign_v2/libs/assign/v2/test/ref/csv_array.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/ref/csv_array.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/ref/csv_array.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -22,7 +22,8 @@
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
{
//[ref_csv_array
typedef int const T;
@@ -43,8 +44,8 @@
BOOST_ASSIGN_V2_CHECK( &b == &z );
}
{
- T& a = (*boost::begin( ar ) );
- T& b = *boost::next( boost::begin( ar ), 2 );
+ T& a = (*begin( ar ) );
+ T& b = *next( begin( ar ), 2 );
BOOST_ASSIGN_V2_CHECK( &a == &x );
BOOST_ASSIGN_V2_CHECK( &b == &z );
@@ -54,7 +55,7 @@
//[ref_csv_array_w
typedef int T; T x, y, z;
std::vector<T> r( 3 ); r[0] = 72; r[1] = 31; r[2] = 48;
- boost::copy( r, boost::begin(
+ boost::copy( r, begin(
as2::ref::csv_array( x, y, z ) | as2::ref::_get
)
);
Modified: sandbox/assign_v2/libs/assign/v2/test/ref/list.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/ref/list.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/ref/list.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -23,33 +23,38 @@
namespace xxx_ref{
namespace xxx_list{
+ // --User may skip this file-- //
+ // It checks internal details. //
+ // --------------------------- //
+
void test()
{
- namespace as2 = boost::assign::v2;
- typedef boost::use_default tag_;
+ using namespace boost;
+ namespace as2 = assign::v2;
+ typedef use_default tag_;
typedef std::string str_;
{
typedef int t0_;
typedef int const t1_;
typedef const char t2_ [2];
- typedef boost::add_reference<t0_>::type r0_;
+ typedef add_reference<t0_>::type r0_;
/* // TODO possible extension
#ifndef BOOST_NO_RVALUE_REFERENCES
typedef int r1_;
#else*/
- typedef boost::add_reference<t1_>::type r1_;
+ typedef add_reference<t1_>::type r1_;
//#endif
- typedef boost::add_reference<t2_>::type r2_;
+ typedef add_reference<t2_>::type r2_;
t0_ a = 0;
#define B 2
t2_ c = "c";
typedef as2::ref::nth_result_of::list<tag_> result_;
- typedef boost::mpl::apply1<result_,
- boost::mpl::vector<r0_, r1_, r2_>
+ typedef mpl::apply1<result_,
+ mpl::vector<r0_, r1_, r2_>
>::type ar_;
ar_ ar = as2::ref::list<tag_>( as2::_nil )( a )( B )( c );
// TODO GCC4.4 wants fully qual
@@ -60,15 +65,15 @@
#undef B
}
{
- typedef int t_; typedef boost::add_reference<t_>::type r_;
+ typedef int t_; typedef add_reference<t_>::type r_;
t_ a = 0;
t_ b = 1;
t_ c = 2;
typedef as2::ref::copy_wrapper<t_>::type w_;
- typedef boost::array<w_,3> arw_;
+ typedef array<w_,3> arw_;
typedef as2::ref::nth_result_of::list<tag_> result_;
- typedef boost::mpl::apply1<result_,
- boost::mpl::vector<r_, r_, r_>
+ typedef mpl::apply1<result_,
+ mpl::vector<r_, r_, r_>
>::type ar_;
ar_ ar = as2::ref::list<tag_>( as2::_nil )( a )( b )( c );
arw_ arw;
@@ -87,8 +92,8 @@
typedef as2::ref::list_aux::policy_helper3<
u1_, l_
>::type value_;
- BOOST_MPL_ASSERT((boost::is_same<value_, u1_>));
- typedef boost::mpl::apply2<
+ BOOST_MPL_ASSERT((is_same<value_, u1_>));
+ typedef mpl::apply2<
as2::ref::list_aux::policy<tag_>,
as2::ref::list_aux::void_,
as2::ref::list_aux::nil
@@ -102,27 +107,27 @@
typedef as2::ref::list_aux::policy_helper3<
u1_, l_
>::type val_;
- BOOST_MPL_ASSERT(( boost::is_same<val_, int> ));
+ BOOST_MPL_ASSERT(( is_same<val_, int> ));
}
{
typedef int const u1_;
typedef as2::ref::list_aux::policy_helper3<
u1_, l_
>::type val_;
- BOOST_MPL_ASSERT(( boost::is_same<val_, int const> ));
+ BOOST_MPL_ASSERT(( is_same<val_, int const> ));
}
}
}
{
- typedef int t_; typedef boost::add_reference<t_>::type r_;
+ typedef int t_; typedef add_reference<t_>::type r_;
t_ a = 0;
t_ b = 1;
t_ c = 2;
typedef as2::ref::alloc_tag::lazy_alloc tag_;
typedef as2::ref::nth_result_of::list<tag_> result_;
- typedef boost::mpl::apply1<result_,
- boost::mpl::vector<r_, r_, r_>
+ typedef mpl::apply1<result_,
+ mpl::vector<r_, r_, r_>
>::type ar_;
ar_ ar = as2::ref::list<tag_>( as2::_nil )( a )( b )( c );
Modified: sandbox/assign_v2/libs/assign/v2/test/ref/list_tuple.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/ref/list_tuple.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/ref/list_tuple.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -20,6 +20,10 @@
namespace xxx_ref{
namespace xxx_list_tuple{
+ // --User may skip this file-- //
+ // It checks internal details. //
+ // --------------------------- //
+
void test()
{
namespace as2 = boost::assign::v2;
Modified: sandbox/assign_v2/libs/assign/v2/test/ref/wrapper.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/ref/wrapper.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/ref/wrapper.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -19,10 +19,10 @@
void test()
{
- using namespace boost::assign::v2;
+ namespace as2 = boost::assign::v2;
typedef int val_;
{
- typedef ref::copy_wrapper<val_>::type w_;
+ typedef as2::ref::copy_wrapper<val_>::type w_;
w_ w;
val_ a = 1, b = 2, c = 3;
w.rebind( a ); BOOST_ASSIGN_V2_CHECK( &w.get() == &a );
@@ -30,7 +30,7 @@
w = c; BOOST_ASSIGN_V2_CHECK( a == c );
}
{
- typedef ref::copy_wrapper<val_ const>::type w_;
+ typedef as2::ref::copy_wrapper<val_ const>::type w_;
w_ w;
val_ a = 1;
w.rebind( a ); BOOST_ASSIGN_V2_CHECK( &w.get() == &a );
@@ -38,9 +38,9 @@
#if BOOST_ASSIGN_V2_ENABLE_CPP0X
{
typedef val_ const cval_;
- typedef ref::wrapper_param<val_>::type param_;
+ typedef as2::ref::wrapper_param<val_>::type param_;
BOOST_MPL_ASSERT(( boost::is_same<param_, cval_> ));
- typedef ref::copy_wrapper<param_>::type w_;
+ typedef as2::ref::copy_wrapper<param_>::type w_;
{
val_&& a = 1;
w_ w( a );
Modified: sandbox/assign_v2/libs/assign/v2/test/utility/chain.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/chain.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/chain.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -28,7 +28,8 @@
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
{
namespace ns = as2::check_chain_aux;
{ typedef int T; ns::static_<T>(); ns::static_<T>(); }
@@ -37,47 +38,45 @@
// Non-Boost.Assign.v2 containers
{
//[chain_r
- typedef int T;
- boost::array<T, 2> cont1; cont1[0] = 0; cont1[1] = 1;
- std::list<T> cont2; cont2.push_back( 2 ); cont2.push_back( 3 );
- std::vector<T> joined( boost::begin( cont1 ), boost::end( cont1 ) );
- boost::copy( cont2, std::back_inserter( joined ) );
+ typedef std::string T;
+ array<T, 2> head; head[0] = "A"; head[1] = "B";
+ std::list<T> tail; tail.push_back( "Y" ); tail.push_back( "Z" );
+ std::vector<T> joined( begin( head ), end( head ) ); copy( tail, std::back_inserter( joined ) );
BOOST_ASSIGN_V2_CHECK(
- boost::range::equal( joined, cont1 | as2::_chain( cont2 ) )
+ range::equal( joined, head | as2::_chain( tail ) )
);
//]
}
{
//[chain_w
- typedef int T; std::vector<T> r( 4 );
- r[0] = 1; r[1] = 2; r[2] = 0; r[3] = 5;
- boost::array<T, 2> cont1;
- std::list<T> cont2( r.size() - cont1.size() );
- boost::copy( r, boost::begin( cont1 | as2::_chain( cont2 ) ) );
- BOOST_ASSIGN_V2_CHECK( cont1[0] == r[0] );
- BOOST_ASSIGN_V2_CHECK( cont1[1] == r[1] );
- BOOST_ASSIGN_V2_CHECK( cont2.front() == r[2] );
- BOOST_ASSIGN_V2_CHECK( cont2.back() == r[3] );
+ typedef std::string note; std::vector<note> scale( 4 );
+ scale[0] = "do"; scale[1] = "re"; scale[2] = "mi";
+ scale[3] = "fa"; scale[4] = "so"; scale[5] = "la"; scale[6] = "si";
+ array<note, 2> do_mi; std::list<note> fa_si( 4 );
+ copy( scale, begin( do_mi | as2::_chain( fa_si ) ) );
+ BOOST_ASSIGN_V2_CHECK( do_mi[0] == "do" );
+ BOOST_ASSIGN_V2_CHECK( do_mi[1] == "mi" );
+ BOOST_ASSIGN_V2_CHECK( fa_si.front() == "fa" );
+ BOOST_ASSIGN_V2_CHECK( fa_si.back() == "si" );
//]
}
// Boost.Assign.v2 containers
{
//[chain_ref_array
- /*<< Needed to bring && into scope >>*/ using namespace boost::assign::v2;
- std::vector<int> powers( 3 ); powers[0] = 1;
- for(int i = 1; i < 8; i++){ powers[i] = powers[ i - 1 ] * 2; }
- boost::array<int, 5> first5; int x, y, z;
+ /*<< Needed to bring && into scope >>*/ using namespace assign::v2;
+ std::vector<int> consecutive8( 8 ); for(int i = 1; i < 8; i++){ consecutive8[i] = 1 + i; }
+ array<int, 5> consecutive5; int six, seven, eight;
boost::copy(
- powers,
- boost::begin(
- first5 && (/*<< rvalue! >>*/ as2::ref::csv_array( x, y, z ) | as2::ref::_get )
+ consecutive8,
+ begin(
+ consecutive5 && (/*<< rvalue! >>*/ as2::ref::csv_array( six, seven, eight ) | as2::ref::_get )
)
);
- BOOST_ASSIGN_V2_CHECK( first5.front() == powers.front() );
- BOOST_ASSIGN_V2_CHECK( first5.back() == powers[first5.size()-1] );
- BOOST_ASSIGN_V2_CHECK( x == powers[first5.size()] );
- BOOST_ASSIGN_V2_CHECK( z == powers.back() );
+ BOOST_ASSIGN_V2_CHECK( consecutive5.front() == 1 );
+ BOOST_ASSIGN_V2_CHECK( consecutive5.back() == 5 );
+ BOOST_ASSIGN_V2_CHECK( six == 6 );
+ BOOST_ASSIGN_V2_CHECK( eight == 8 );
//]
}
Modified: sandbox/assign_v2/libs/assign/v2/test/utility/conversion.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/conversion.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/conversion.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -34,14 +34,15 @@
void test()
{
- namespace as2 = boost::assign::v2;
+ using namespace boost;
+ namespace as2 = assign::v2;
namespace ns = as2::check_aux;
// Non-Boost.Assign.2.0 containers - fully qualified as2::converter()
{
//[convert_inpl
- std::vector<int> v( 3 ); v[0] = 1; v[1] = 2; v[2] = 0;
- typedef boost::array<int, 3> ar_;
+ std::vector<int> v( 3 ); v[0] = 72; v[1] = 31; v[2] = 48;
+ typedef array<int, 3> ar_;
BOOST_ASSIGN_V2_CHECK(
( as2::converter( v ).type<ar_>() )[1] == v[1]
);
Modified: sandbox/assign_v2/libs/assign/v2/test/utility/csv.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/csv.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/csv.cpp 2011-03-11 12:15:47 EST (Fri, 11 Mar 2011)
@@ -8,8 +8,6 @@
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
//////////////////////////////////////////////////////////////////////////////
#include <deque>
-#include <boost/typeof/typeof.hpp>
-#include <boost/lambda/lambda.hpp>
#include <boost/assign/v2/detail/config/check.hpp>
#include <boost/assign/v2/utility/csv.hpp>
#include <boost/assign/v2/put/deque.hpp>
@@ -21,39 +19,37 @@
namespace xxx_utiliy{
namespace xxx_csv{
- // Tests interaction between different functionalities
-
void test(){
- namespace as2 = boost::assign::v2;
- namespace lambda = boost::lambda;
+ using namespace boost;
+ namespace as2 = assign::v2;
{
//[csv_put
- std::deque<int> powers;
- as2::csv( as2::put( powers ), 16, 8, 4, 2, 1 );
+ std::deque<int> cont;
+ as2::csv( as2::put( cont ), 72, 31, 48 );
- BOOST_ASSIGN_V2_CHECK( powers[0] == 6 );
- BOOST_ASSIGN_V2_CHECK( powers[4] == 1 );
+ BOOST_ASSIGN_V2_CHECK( cont.front() == 6 );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == 48 );
//]
}
{
//[csv_put_modulo
- std::deque<int> powers;
- as2::csv( as2::put( powers ) % as2::_push_front, 16, 8, 4, 2, 1 );
+ std::deque<int> cont;
+ as2::csv( as2::put( cont ) % as2::_push_front, 72, 31, 48 );
- BOOST_ASSIGN_V2_CHECK( powers[0] == 1 );
- BOOST_ASSIGN_V2_CHECK( powers[4] == 16 );
+ BOOST_ASSIGN_V2_CHECK( cont.front() == 48 );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == 72 );
//]
}
{
//[csv_deque_modulo
BOOST_AUTO(
- powers,
- as2::csv( as2::deque<int>( as2::_nil ) % as2::_push_front, 16, 8, 4, 2, 1 )
+ cont,
+ as2::csv( as2::deque<int>( as2::_nil ) % as2::_push_front, 72, 31, 48 )
);
- BOOST_ASSIGN_V2_CHECK( powers[0] == 1 );
- BOOST_ASSIGN_V2_CHECK( powers[4] == 16 );
+ BOOST_ASSIGN_V2_CHECK( cont.front() == 48 );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == 72 );
//]
}
}
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