|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71102 - in sandbox/assign_v2: boost/assign/v2/conversion boost/assign/v2/deque boost/assign/v2/detail boost/assign/v2/interpreter boost/assign/v2/put boost/assign/v2/ref/array libs/assign/v2 libs/assign/v2/test libs/assign/v2/test/option libs/assign/v2/test/put libs/assign/v2/test/unit_testing
From: erwann.rogard_at_[hidden]
Date: 2011-04-07 21:45:40
Author: e_r
Date: 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
New Revision: 71102
URL: http://svn.boost.org/trac/boost/changeset/71102
Log:
upd assign_v2
Text files modified:
sandbox/assign_v2/boost/assign/v2/conversion/check.hpp | 8 ----
sandbox/assign_v2/boost/assign/v2/conversion/convert.hpp | 20 +++++-----
sandbox/assign_v2/boost/assign/v2/conversion/converter.hpp | 12 +++---
sandbox/assign_v2/boost/assign/v2/deque/csv_deque.hpp | 50 ++++--------------------
sandbox/assign_v2/boost/assign/v2/detail/speed.hpp | 3 -
sandbox/assign_v2/boost/assign/v2/interpreter/csv.hpp | 17 ++++----
sandbox/assign_v2/boost/assign/v2/put/csv_put.hpp | 63 +++++++++++++++++++------------
sandbox/assign_v2/boost/assign/v2/ref/array/csv_array.hpp | 6 +-
sandbox/assign_v2/libs/assign/v2/test/conversion.cpp | 52 +++++++++++++-------------
sandbox/assign_v2/libs/assign/v2/test/option/data.cpp | 31 ++++++++-------
sandbox/assign_v2/libs/assign/v2/test/put/put.cpp | 80 ++++++++++++++++++++--------------------
sandbox/assign_v2/libs/assign/v2/test/unit_testing/put.cpp | 2
sandbox/assign_v2/libs/assign/v2/tutorial.cpp | 20 +++++++---
13 files changed, 174 insertions(+), 190 deletions(-)
Modified: sandbox/assign_v2/boost/assign/v2/conversion/check.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/conversion/check.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/conversion/check.hpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -53,14 +53,6 @@
typedef std::stack<int> stack_;
typedef std::vector<int> vec_;
- BOOST_MPL_ASSERT(( as2::conversion_aux::use_put<ar_, R> ));
- BOOST_MPL_ASSERT(( as2::conversion_aux::use_put<stack_, R> ));
- BOOST_MPL_ASSERT(( as2::conversion_aux::use_put<queue_, R> ));
- BOOST_MPL_ASSERT_NOT(( as2::conversion_aux::use_put<deque_, R> ));
- BOOST_MPL_ASSERT_NOT(( as2::conversion_aux::use_put<list_, R> ));
- BOOST_MPL_ASSERT_NOT(( as2::conversion_aux::use_put<set_, R> ));
- BOOST_MPL_ASSERT_NOT(( as2::conversion_aux::use_put<vec_, R> ));
-
BOOST_MPL_ASSERT(( boost::is_same<
typename as2::conversion_aux::deduce_tag<ar_, R>::type,
convert_tag::put
Modified: sandbox/assign_v2/boost/assign/v2/conversion/convert.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/conversion/convert.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/conversion/convert.hpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -34,10 +34,10 @@
return cont;
}
- template<typename C, typename Arg>
+ template<typename C, typename Arg>
Arg const& initializer( Arg const& arg )
{
- return arg;
+ return arg;
}
template<typename C, typename Arg, typename R>
@@ -75,7 +75,7 @@
template<typename C, typename Arg = nil_>
struct convert/*<-*/{
- convert(){}
+ convert(){}
convert(Arg arg):arg_( arg ){}
Arg const& arg()const{ return this->arg_; }
@@ -93,23 +93,23 @@
}// conversion_aux
- template<typename C, typename Arg = nil_>
- struct convert/*<-*/
- : conversion_aux::convert<C, Arg>
+ template<typename C, typename Arg = nil_>
+ struct convert/*<-*/
+ : conversion_aux::convert<C, Arg>
{
- typedef conversion_aux::convert<C> super_t;
+ typedef conversion_aux::convert<C> super_t;
- convert()/*<-*/{}/*->*/
+ convert()/*<-*/{}/*->*/
convert(Arg const& arg)
- : super_t( arg )
+ : super_t( arg )
{}
template<typename Arg1>
convert<C, Arg1>
operator+=(Arg1 const& arg1)
{
- return convert<C, Arg1>( arg1 );
+ return convert<C, Arg1>( arg1 );
}
}/*->*/;
Modified: sandbox/assign_v2/boost/assign/v2/conversion/converter.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/conversion/converter.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/conversion/converter.hpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -28,16 +28,16 @@
class converter
{
- typedef boost::iterator_range<
- typename boost::range_iterator<
- typename boost::add_const<R>::type
+ typedef boost::iterator_range<
+ typename boost::range_iterator<
+ typename boost::add_const<R>::type
>::type
> source_type;
public:
explicit converter(
- Arg const& arg,
+ Arg const& arg,
typename call_traits<R>::param_type source
)/*<-*/
: arg_( arg ), source_( boost::make_iterator_range( source ) )
@@ -56,14 +56,14 @@
template<typename C>
C type()const/*<-*/
{
- typedef convert<C, Arg> convert_;
+ typedef convert<C, Arg> convert_;
return this->source_ | convert_( this->arg_ );
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
//<-
private:
Arg arg_;
- source_type source_;
+ source_type source_;
//->
};
Modified: sandbox/assign_v2/boost/assign/v2/deque/csv_deque.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/deque/csv_deque.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/deque/csv_deque.hpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -45,7 +45,7 @@
{}/*->*/;
template<typename Os, typename T>
- struct csv_deque_option/*<-*/
+ struct csv_deque_option/*<-*/
: modulo_result<
typename result_of::csv_deque<T>::type,
Os
@@ -58,23 +58,20 @@
typename result_of::csv_deque<T>::type
csv_deque()/*<-*/{
return typename result_of::csv_deque<T>::type();
- }/*->*/;
+ }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
//<-
#if BOOST_ASSIGN_V2_ENABLE_CPP0X
//->
-
- // Explicit T
-
- template<typename T, typename U, typename... Args>
+ template<typename T, typename... Args>
typename boost::lazy_disable_if<
- is_option_crtp_cpp0x<U>,
+ is_option_crtp_cpp0x<T>,
result_of::csv_deque<T>
>::type
- csv_deque(U&& u, Args&& ... args)/*<-*/
+ csv_deque(T&& t, Args&& ... args)/*<-*/
{
typename result_of::csv_deque<T>::type result;
- csv( result, std::forward<U>( u ), std::forward<Args>( args )... );
+ csv( result, std::forward<T>( t ), std::forward<Args>( args )... );
return result;
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
@@ -83,45 +80,16 @@
is_option_crtp<O>,
result_of::csv_deque_option<O, T>
>::type
- csv_deque(O const& options, Args&& ... args)/*<-*/
+ csv_deque(O const& options, T&& t, Args&& ... args)/*<-*/
{
typedef typename result_of::csv_deque<T>::type before_op_;
typename result_of::csv_deque_option<
O, T
>::type result = before_op_() % options;
- csv( result, std::forward<Args>( args )... );
+ csv( result, std::forward<T>( t ), std::forward<Args>( args )... );
return result;
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
- // Implicit T
-
- template<typename T, typename... Args>
- typename boost::lazy_disable_if<
- is_option_crtp_cpp0x<T>,
- result_of::csv_deque<T>
- >::type
- csv_deque(T&& t, Args&& ... args)/*<-*/
- {
- csv_deque<T>(
- std::forward<T>( t ),
- std::forward<Args>( args )...
- );
- }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
-
- template<typename O, typename T, typename... Args>
- typename boost::lazy_enable_if
- is_option_crtp<O>,
- result_of::csv_deque_option<Os, T>
- >::type
- csv_deque(O const& options, T&& t, Args&& ... args)/*<-*/
- {
- csv_deque<T>(
- options,
- std::forward<T>( t ),
- std::forward<Args>( args )...
- );
- }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
-
//<-
#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
//->
@@ -143,7 +111,7 @@
{}/*->*/;
template<typename Os, typename T>
- struct csv_deque_option/*<-*/
+ struct csv_deque_option/*<-*/
: interpreter_aux::result_of::csv_deque_option<Os, T>
{}/*->*/;
Modified: sandbox/assign_v2/boost/assign/v2/detail/speed.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/speed.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/speed.hpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -21,9 +21,8 @@
#include <boost/assign/list_inserter.hpp>
#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
#if BOOST_ASSIGN_V2_ENABLE_CPP0X
-#include <boost/assign/v2/put/put.hpp>
+#include <boost/assign/v2/put.hpp>
#include <boost/assign/v2/deque.hpp>
-#include <boost/assign/v2/pipe/csv_put.hpp>
#include <boost/assign/v2/ref/array/array.hpp>
#include <boost/assign/v2/ref/array/csv_array.hpp>
#include <boost/type_traits/remove_reference.hpp>
Modified: sandbox/assign_v2/boost/assign/v2/interpreter/csv.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/interpreter/csv.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/csv.hpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -35,20 +35,21 @@
//->
template<typename C, typename F, typename MTag, typename DTag, typename D>
- void csv(
+ void csv(
interpreter_crtp<C, F, MTag, DTag, D> const& interpreter
)/*<-*/
{
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
- template<typename C, typename F, typename MTag, typename DTag, typename D>
- void csv(
- interpreter_crtp<C, F, MTag, DTag, D> const& interpreter,
- T&& t, Args&&... args
+ template<typename C, typename F, typename MTag, typename DTag, typename D
+ , typename T, typename... Args>
+ void csv(
+ interpreter_crtp<C, F, MTag, DTag, D> const& interpreter,
+ T&& t, Args&&... args
)/*<-*/
{
- return csv(
- interpreter( std::forward<T>( t ) ),
- std::forward<Args>( args )...
+ return csv(
+ interpreter( std::forward<T>( t ) ),
+ std::forward<Args>( args )...
);
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
Modified: sandbox/assign_v2/boost/assign/v2/put/csv_put.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/csv_put.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/csv_put.hpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -44,7 +44,7 @@
namespace result_of{
template<typename C, typename F, typename MTag, typename DTag>
- struct if_csv_ready/*<-*/
+ struct if_csv_ready/*<-*/
: ::boost::mpl::identity<
put_interpreter<C, F, MTag, DTag>
>
@@ -71,8 +71,8 @@
/*<-*/
template<typename C, typename F, typename MTag, typename DTag>
typename result_of::if_csv_ready<C, F, MTag, DTag>::type
- make_csv_ready(
- put_interpreter<C, F, MTag, DTag> const& interpreter,
+ make_csv_ready(
+ put_interpreter<C, F, MTag, DTag> const& interpreter,
boost::mpl::true_ suitable
)
{
@@ -81,8 +81,8 @@
template<typename C, typename F, typename MTag, typename DTag>
typename result_of::else_csv_ready<C, F, MTag, DTag>::type
- make_csv_ready(
- put_interpreter<C, F, MTag, DTag> const& interpreter,
+ make_csv_ready(
+ put_interpreter<C, F, MTag, DTag> const& interpreter,
boost::mpl::false_ suitable
)
{
@@ -93,9 +93,9 @@
typename result_of::make_csv_ready<C, F, MTag, DTag>::type
make_csv_ready( put_interpreter<C, F, MTag, DTag> const& interpreter)
/*->*/{
- return make_csv_ready(
- interpreter,
- typename csv_ready<F>::type()
+ return make_csv_ready(
+ interpreter,
+ typename csv_ready<F>::type()
);
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
@@ -103,29 +103,42 @@
#if BOOST_ASSIGN_V2_ENABLE_CPP0X
//->
- template<typename C, typename O, bool is, typename Args>
- typename boost::enable_if<
- is_option_crtp<O>
- >::type csv_put( C& cont, option_crtp<O, is> const& crtp, Args&&... args )
+ template<typename C, typename O, bool is, typename... Args>
+ typename boost::enable_if<
+ is_option_crtp<O>
+ >::type csv_put(
+ C& cont,
+ option_crtp<O, is> const& crtp,
+ Args&&... args
+ )
/*<-*/
{
O const& options = static_cast<O const&>( crtp );
csv(
- make_csv_ready(
+ make_csv_ready(
put( cont ) % options
),
- std::forward<Args>( args )...
+ std::forward<Args>( args )...
);
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
- template<typename C, typename Args>
- typename boost::disable_if<
- is_option_crtp<O>
- >::type csv_put( C& cont, Args&&... args)/*<-*/
+ template<typename C, typename T, typename... Args>
+ typename boost::disable_if<
+ is_option_crtp_cpp0x<T>
+ >::type csv_put( C& cont, T&& t, Args&&... args)/*<-*/
{
csv(
make_csv_ready( put( cont ) ),
- std::forward<Args>( args )...
+ std::forward<T>( t ),
+ std::forward<Args>( args )...
+ );
+ }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ template<typename C>
+ void csv_put( C& cont)/*<-*/
+ {
+ csv(
+ make_csv_ready( put( cont ) )
);
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
@@ -158,7 +171,7 @@
)(
static_cast<super2_t const&>( *this )
);
-
+
return cont;
}
@@ -182,7 +195,7 @@
}// result_of
-
+
template<typename R>
typename result_of::delay_csv_put<R const>::type
delay_csv_put(R const& range)/*<-*/
@@ -195,12 +208,12 @@
typename result_of::delay_csv_put<R const, Os>::type
delay_csv_put(option_crtp<Os> const& options, R const& range)/*<-*/
{
- return delayed_csv_put<R const, Os>(
- static_cast<Os const&>( options ), range
+ return delayed_csv_put<R const, Os>(
+ static_cast<Os const&>( options ), range
);
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
-}// interpreter_aux
+}// interpreter_aux
//<-
#if BOOST_ASSIGN_V2_ENABLE_CPP0X
//->
@@ -214,7 +227,7 @@
namespace result_of{
template<typename R, typename Os = empty_list_option_>
- struct delay_csv_put
+ struct delay_csv_put
: interpreter_aux::result_of::delay_csv_put<R, Os>
{};
Modified: sandbox/assign_v2/boost/assign/v2/ref/array/csv_array.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/array/csv_array.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/ref/array/csv_array.hpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -56,7 +56,7 @@
namespace result_of{
template<typename U, typename... Args>
- struct csv_array/*<-*/
+ struct csv_array/*<-*/
: nth_result_of::csv_array<
1 + sizeof...(Args), U
>
@@ -122,8 +122,8 @@
namespace result_of{
template<typename U, typename... Args>
- struct csv_array/*<-*/
- : array_aux::csv_array<U, ...Args>
+ struct csv_array/*<-*/
+ : array_aux::result_of::csv_array<U, Args...>
{}/*->*/;
}// result_of
Modified: sandbox/assign_v2/libs/assign/v2/test/conversion.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/conversion.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/conversion.cpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -72,27 +72,27 @@
as2::result_of::converter<R>::type source( benchmark );
{
- typedef boost::array<T, 10> C;
+ typedef boost::array<T, 10> C;
f<C>( source, benchmark );
}
{
- typedef std::deque<T> C;
+ typedef std::deque<T> C;
f<C>( source, benchmark );
}
{
- typedef std::list<T> C;
+ typedef std::list<T> C;
f<C>( source, benchmark );
}
{
- typedef std::queue<T> C;
+ typedef std::queue<T> C;
f<C>( source, benchmark );
}
{
- typedef std::stack<T> C;
+ typedef std::stack<T> C;
f<C>( source, benchmark );
}
{
- typedef std::vector<T> C;
+ typedef std::vector<T> C;
f<C>( source, benchmark );
}
//]
@@ -119,7 +119,7 @@
{
//[test_converter_from_deque
typedef array<int, 5> C; C const& ar = /*<<Notice unqualified>>*/converter(
- as2::csv_deque( 1, 2, 3, 4, 5 )
+ as2::csv_deque( 1, 2, 3, 4, 5 )
);
BOOST_ASSIGN_V2_CHECK(
@@ -135,28 +135,28 @@
//]
}
{
- //[test_converter_multi_array
- typedef boost::multi_array<int, 2> array2_;
- typedef array2_::size_type size_;
- typedef size_ const dim_;
- dim_ dim1 = 3, dim2 = 3;
- array2_ array2 = converter(
- extents[dim1][dim2],
+ //[test_converter_multi_array
+ typedef boost::multi_array<int, 2> array2_;
+ typedef array2_::size_type size_;
+ typedef size_ const dim_;
+ dim_ dim1 = 3, dim2 = 3;
+ array2_ array2 = converter(
+ extents[dim1][dim2],
as2::csv_deque(-1, +1, -1, +1, -1, +1, -1, +1, -1)
);
- const int benchmark [] = {
- -1, +1, -1,
- +1, -1, +1,
- -1, +1, -1
- };
- size_ const n = array2.num_elements();
- BOOST_ASSIGN_V2_CHECK(
- range::equal(
- make_iterator_range( array2.data(), n + array2.data() ),
- make_iterator_range( benchmark, n + benchmark )
- )
- );
+ const int benchmark [] = {
+ -1, +1, -1,
+ +1, -1, +1,
+ -1, +1, -1
+ };
+ size_ const n = array2.num_elements();
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal(
+ make_iterator_range( array2.data(), n + array2.data() ),
+ make_iterator_range( benchmark, n + benchmark )
+ )
+ );
//]
}
}
Modified: sandbox/assign_v2/libs/assign/v2/test/option/data.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/option/data.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/option/data.cpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -26,6 +26,9 @@
#include <boost/typeof/typeof.hpp>
#include <libs/assign/v2/test/option/data.h>
+// TODO
+#include <iostream>
+
namespace test_assign_v2{
namespace xxx_option{
namespace xxx_data{
@@ -40,10 +43,10 @@
std::vector<double> exponent;
/*<-*/typedef double(*fp)(double);/*->*/
typedef function<double(double)> f_;
- as2::csv_put(
+ as2::csv_put(
exponent
- , as2::_data = f_( /*<-*/fp(/*->*/ log10 /*<-*/)/*->*/ )
- , 1.0, 10.0, 100.0, 1000.0, 10000.0
+ , as2::_data = f_( /*<-*/fp(/*->*/ log10 /*<-*/)/*->*/ )
+ , 1.0, 10.0, 100.0, 1000.0, 10000.0
);
double eps = numeric::bounds<double>::smallest();
@@ -54,25 +57,25 @@
{
//[test_option_data_recursive
int k = 1;
-
- BOOST_ASSIGN_V2_CHECK(
- range::equal(
- as2::csv_deque<int>(
- as2::_data = ( lambda::var( k ) *= lambda::_1 ),
- 1, 2, 3, 4, 5
- ),
- as2::csv_deque( 1, 2, 6, 24, 120 )
- )
+
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal(
+ as2::csv_deque(
+ as2::_data = ( lambda::var( k ) *= lambda::_1 ),
+ 1, 2, 3, 4, 5
+ ),
+ as2::csv_deque( 1, 2, 6, 24, 120 )
+ )
);
//]
}
{
//[test_option_data_value
- typedef std::string word_;
+ typedef std::string word_;
const char x[] = "foo";
const char y[4] = { 'b', 'a', 'r', '\0' };
word_ z = "***baz";
- typedef std::map<int, word_> C;
+ typedef std::map<int, word_> C;
typedef C::value_type T;
typedef C::mapped_type D;
C map;
Modified: sandbox/assign_v2/libs/assign/v2/test/put/put.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/put.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/put.cpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -73,8 +73,8 @@
std::vector<int> numeric( 10 ); iota( numeric, 0 ); typedef std::string str_;
typedef variant< int, str_ > key_; array<key_, 16> keypad;
as2::csv_put( keypad
- , "+", "-", "*", "/", "=", "."
- , as2::as_arg_list( numeric )
+ , "+", "-", "*", "/", "=", "."
+ , as2::as_arg_list( numeric )
);
BOOST_ASSIGN_V2_CHECK( get<str_>( keypad.front() ) == "+" );
@@ -110,13 +110,13 @@
}
// SEQUENCE
{
- // Note that although `number( str_( "011" ) )`, for instance,
+ // Note that although `number( str_( "011" ) )`, for instance,
// is valid, `range_3bit.push_back( str_( "011" ) )` isn't
//[test_csv_put_bitset
- typedef std::string str_; typedef std::bitset<3> number;
+ typedef std::string str_; typedef std::bitset<3> number;
std::vector<number> range_3bit;
- as2::csv_put(
- range_3bit
+ as2::csv_put(
+ range_3bit
, str_( "000" ), str_( "001" )
, str_( "010" ), str_( "011" )
, str_( "100" ), str_( "101" )
@@ -134,8 +134,8 @@
// http://bioinfo.mbb.yale.edu/~mbg/dom/fun3/area-codes/
//[test_put_area_codes
typedef const char state_ [3]; state_ ct = "CT", nj = "NJ", ny = "NY";
- typedef int code_;
- typedef tuple<state_/*<<Notice the [*reference]>>*/&, code_> data_;
+ typedef int code_;
+ typedef tuple<state_/*<<Notice the [*reference]>>*/&, code_> data_;
std::deque< data_ > region;
as2::put( region )
( ny, 212 )( ny, 718 )( ny, 516 )( ny, 914 )
@@ -149,20 +149,20 @@
BOOST_ASSIGN_V2_CHECK( get<0>( region.back() ) == ct );
}
//SET
- {
+ {
//[test_csv_put_unordered_set
typedef std::string word_;
typedef boost::unordered_set<word_> C;
-
+
C set, benchmark;
benchmark.insert( "foo" );
benchmark.insert( "bar" );
benchmark.insert( "baz" );
-
+
BOOST_ASSIGN_V2_CHECK(
range::equal(
- set | as2::delay_csv_put(
- as2::csv_deque<word_>( "foo", "bar", "baz" )
+ set | as2::delay_csv_put(
+ as2::csv_deque<word_>( "foo", "bar", "baz" )
),
benchmark
)
@@ -170,14 +170,14 @@
//]
}
// MAP
- {
+ {
//[test_put_unordered_map
- typedef std::string word_;
+ typedef std::string word_;
const char x[] = "foo";
const char y[4] = { 'b', 'a', 'r', '\0' };
word_ z = "***baz";
boost::unordered_map<int, word_> map;
-
+
as2::put( map )( 1, x, 3 )( 2, y )( 3, z, 3, 3 )( 4, "qux");
assert( map[1] == "foo" ); assert( map[2] == "bar" );
@@ -187,10 +187,10 @@
{
//[test_csv_put_map
typedef std::string month_; typedef int days_;
- typedef std::map<month_, days_> C;
+ typedef std::map<month_, days_> C;
typedef C::value_type T;
C map, benchmark;
-
+
as2::csv_put( map, T("jan", 31 ), T( "feb", 28 ), T( "mar", 31 ) );
BOOST_ASSIGN_V2_CHECK( map["jan"] == 31 );
@@ -203,25 +203,25 @@
//[test_csv_put_multi_array
typedef boost::multi_array<int, 3> array3_;
typedef array3_::size_type size_;
-
- typedef const int dim_;
- dim_ dim1 = 2, dim2 = 3, dim3 = 4;
-
+
+ typedef const size_ dim_;
+ dim_ dim1 = 2, dim2 = 3, dim3 = 4;
+
using boost::extents;
array3_ array3( extents[dim1][dim2][dim3] );
- as2::csv_put(
+ as2::csv_put(
array3,
- 0, 1, 2, 3,
- 4, 5, 6, 7,
- 8, 9, 10, 11,
-
- 12, 13, 14, 15,
- 16, 17, 18, 19,
- 20, 21, 22, 23
+ 0, 1, 2, 3,
+ 4, 5, 6, 7,
+ 8, 9, 10, 11,
+
+ 12, 13, 14, 15,
+ 16, 17, 18, 19,
+ 20, 21, 22, 23
);
-
- size_ i = 0;
+
+ int i = 0;
for( size_ i1 = 0; i1 < dim1; i1++ )
{
for( size_ i2 = 0; i2 < dim2; i2++ )
@@ -248,32 +248,32 @@
BOOST_ASSIGN_V2_CHECK(
boost::range::equal(
- as2::csv_deque(
- view[0][0], view[0][1],
+ as2::csv_deque(
+ view[0][0], view[0][1],
view[1][0], view[1][1]
),
- as2::csv_deque(
- 99, 98,
+ as2::csv_deque(
+ 99, 98,
97, 96
)
)
);
-
+
}
// OTHER
{
//test_csv_put_cb
boost::circular_buffer<int> cb(3);
as2::csv_put( cb, 1, 2, 3 );
-
+
BOOST_ASSIGN_V2_CHECK(
range::equal(cb, as2::csv_deque(1, 2, 3) )
);
BOOST_ASSIGN_V2_CHECK(
range::equal(
- cb | as2::delay_csv_put( as2::csv_deque( 4, 5 ) ),
- as2::csv_deque(3, 4, 5)
+ cb | as2::delay_csv_put( as2::csv_deque( 4, 5 ) ),
+ as2::csv_deque(3, 4, 5)
)
);
//]
Modified: sandbox/assign_v2/libs/assign/v2/test/unit_testing/put.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/unit_testing/put.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/unit_testing/put.cpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -13,8 +13,8 @@
#include <boost/test/test_tools.hpp>
#define BOOST_ASSIGN_V2_CHECK( p ) BOOST_CHECK( p )
+#include <libs/assign/v2/test/put/put.cpp> // has to come first as overrides LIMIT_CSV_ARITY
#include <libs/assign/v2/test/put/ptr.cpp>
-#include <libs/assign/v2/test/put/put.cpp>
#include <boost/test/unit_test.hpp>
using boost::unit_test::test_suite;
Modified: sandbox/assign_v2/libs/assign/v2/tutorial.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/tutorial.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/tutorial.cpp 2011-04-07 21:45:39 EDT (Thu, 07 Apr 2011)
@@ -48,20 +48,26 @@
}
{
//[tutorial_delay_csv_put
- std::deque<int> source( 6 ), sorted; iota( source, 0 );
+ std::deque<int> source( 6 ), target; iota( source, 0 );
range::stable_partition(
- sorted | delay_csv_put( source ),
+ target | delay_csv_put( source ),
lambda::_1 % 2
);
//]
//[tutorial_csv_deque
- assert(
- range::equal( sorted, csv_deque(1, 3, 5, 0, 2, 4) )
+ assert(
+ range::equal( target, csv_deque(1, 3, 5, 0, 2, 4) )
);
//]
}
{
+ //[tutorial_empty_deque
+ assert( deque<int>( _nil ).size() == 0 ); // Functor form
+ assert( csv_deque<int>().size() == 0 ); // Csv form
+ //]
+ }
+ {
//[tutorial_ref_array
int x = 4, y = 6, z = -1;
int const& max = *max_element( ref::csv_array( x, y, z ) );
@@ -102,7 +108,9 @@
typedef std::queue<int> C;
C fifo = converter( csv_deque( 1, 2, 3 ) );
- assert( fifo.front() == 1 ); assert( fifo.back() == 3 );
+
+ assert( fifo.front() == 1 );
+ assert( fifo.back() == 3 );
//]
//[tutorial_convert
@@ -118,7 +126,7 @@
const char y[4] = { 'b', 'a', 'r', '\0' };
word_ z = "***baz";
std::map<int, word_> map;
- put( map )/*<<Calls `map.insert( 1, str_( foo, 3 ) )`>>*/( 1, x, 3 )( 2, y )( 3, z, 3, 3 )( 4, "qux");
+ put( map )/*<<Calls `map.insert( 1, word_( x, 3 ) )`>>*/( 1, x, 3 )( 2, y )( 3, z, 3, 3 )( 4, "qux");
assert( map[1] == "foo" ); assert( map[2] == "bar" );
assert( map[3] == "baz" ); assert( map[4] == "qux" );
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