|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69030 - in sandbox/assign_v2/boost/assign/v2: . utility utility/chain utility/convert
From: erwann.rogard_at_[hidden]
Date: 2011-02-19 05:41:28
Author: e_r
Date: 2011-02-19 05:41:26 EST (Sat, 19 Feb 2011)
New Revision: 69030
URL: http://svn.boost.org/trac/boost/changeset/69030
Log:
upd assign_v2
Text files modified:
sandbox/assign_v2/boost/assign/v2/put.hpp | 7 +
sandbox/assign_v2/boost/assign/v2/utility.hpp | 1
sandbox/assign_v2/boost/assign/v2/utility/chain/check.hpp | 153 +++++++++++++++++++--------------------
sandbox/assign_v2/boost/assign/v2/utility/chain/short.hpp | 12 +-
sandbox/assign_v2/boost/assign/v2/utility/convert/check.hpp | 71 ++++++++---------
sandbox/assign_v2/boost/assign/v2/utility/convert/converter.hpp | 7 +
sandbox/assign_v2/boost/assign/v2/utility/sub_range.hpp | 59 ---------------
7 files changed, 127 insertions(+), 183 deletions(-)
Modified: sandbox/assign_v2/boost/assign/v2/put.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put.hpp 2011-02-19 05:41:26 EST (Sat, 19 Feb 2011)
@@ -10,12 +10,13 @@
#ifndef BOOST_ASSIGN_V2_PUT_ER_2010_HPP
#define BOOST_ASSIGN_V2_PUT_ER_2010_HPP
+#include <boost/assign/v2/put/container.hpp>
+#include <boost/assign/v2/put/deduce.hpp>
#include <boost/assign/v2/put/deque.hpp>
+#include <boost/assign/v2/put/ext.hpp>
#include <boost/assign/v2/put/frame.hpp>
-//#include <boost/assign/v2/put/generic.hpp>
-#include <boost/assign/v2/put/modifier.hpp>
#include <boost/assign/v2/put/modulo.hpp>
#include <boost/assign/v2/put/pipe.hpp>
-//#include <boost/assign/v2/put/sub.hpp>
+#include <boost/assign/v2/put/std.hpp>
#endif
Modified: sandbox/assign_v2/boost/assign/v2/utility.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility.hpp 2011-02-19 05:41:26 EST (Sat, 19 Feb 2011)
@@ -11,7 +11,6 @@
#define BOOST_ASSIGN_V2_UTILITY_ER_2010_HPP
#include <boost/assign/v2/utility/chain.hpp>
-#include <boost/assign/v2/utility/sub_range.hpp>
#include <boost/assign/v2/utility/convert.hpp>
#endif
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-02-19 05:41:26 EST (Sat, 19 Feb 2011)
@@ -11,13 +11,15 @@
#define BOOST_ASSIGN_V2_CHAIN_CHECK_ER_2010_HPP
#include <boost/static_assert.hpp>
#include <vector>
+#include <boost/array.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/range/algorithm/copy.hpp>
-#include <boost/assign/v2/detail/checking/range.hpp>
+#include <boost/range/algorithm/equal.hpp>
+#include <boost/assign/v2/detail/config/check.hpp>
#include <boost/assign/v2/ref/wrapper/adaptor_get.hpp>
#include <boost/assign/v2/ref/wrapper/copy.hpp>
#include <boost/assign/v2/utility/chain/use_lvalue.hpp>
@@ -26,8 +28,7 @@
namespace boost{
namespace assign{
namespace v2{
-namespace checking{
-namespace chain{
+namespace check_chain_aux{
template<typename cr1_, typename cr2_, bool the_value>
void verify_use_lvalue()
@@ -79,9 +80,8 @@
}
template<typename T>
- void do_check()
+ void static_()
{
- // mpl checks
{
typedef std::vector<T> vec_;
typedef v2::result_of::chain<vec_, vec_> caller1_;
@@ -104,81 +104,78 @@
verify_mpl<T, true , true , false , false >();
verify_mpl<T, true , true , true , false >();
- // runtime checks
- {
- typedef std::vector<T> vt_;
- vt_ vt1( 2 ), vt2( 3 ), vt3( 3 );
- vt_ vt;
- {
- // Value containers
- namespace ns = v2::checking::constants;
- vt.push_back( ns::a ); // 1
- vt.push_back( ns::b ); // 2
-
- vt.push_back( ns::c ); // 1
- vt.push_back( ns::d ); // 2
- vt.push_back( ns::e ); // 3
-
- vt.push_back( ns::f ); // 1
- vt.push_back( ns::g ); // 2
- vt.push_back( ns::h ); // 3
- {
-
- BOOST_ASSIGN_V2_CHECK( // pre-condition
- vt1.size() + vt2.size() + vt3.size() == vt.size()
- );
- boost::copy(
- vt,
- boost::begin( vt1 | _chain( vt2 ) | _chain( vt3 ) )
- );
- }
- {
- typedef v2::container_tag::range tag_;
- v2::checking::do_check(
- tag_(),
- vt1 | _chain( vt2 ) | _chain( vt3 )
- );
- }
- }
+ }
+
+ template<typename T>
+ void exec()
+ {
+ namespace as2 = boost::assign::v2;
+ typedef std::vector<T> vt_;
+ vt_ vt1( 2 ), vt2( 3 ), vt3( 3 );
+ vt_ vt;
+ {
+ // Value containers
+ vt.push_back( 1 ); // 1
+ vt.push_back( 2 ); // 2
+
+ vt.push_back( -5 ); // 1
+ vt.push_back( 4 ); // 2
+ vt.push_back( 3 ); // 3
+
+ vt.push_back( -7 ); // 1
+ vt.push_back( 8 ); // 2
+ vt.push_back( 9 ); // 3
+ BOOST_ASSIGN_V2_CHECK( // pre-condition
+ vt1.size() + vt2.size() + vt3.size() == vt.size()
+ );
+ }
+ {
+ // Value container
+ boost::copy(
+ vt,
+ boost::begin( vt1 | as2::_chain( vt2 ) | as2::_chain( vt3 ) )
+ );
+ BOOST_ASSIGN_V2_CHECK(
+ boost::equal( vt1 | as2::_chain( vt2 ) , vt )
+ );
+ }
+ {
+ // Mix and Value and Ref-wrapper containers
+ typedef typename ref::copy_wrapper<T>::type w_;
+ typedef boost::is_reference_wrapper<w_> is_;
+
+ // rese to default values
+ vt1.resize( vt1.size() );
+ vt3.resize( vt3.size() );
+
+ T x = -1, y = -1, z = -1;
+ boost::array<w_, 3> vw2;
+ vw2[0].rebind( x );
+ vw2[1].rebind( y );
+ vw2[2].rebind( z );
+ boost::copy(
+ vt,
+ boost::begin(
+ vt1 | as2::_chain(
+ vw2 | ref::_get // necessary
+ ) | as2::_chain( vt3 ) )
+ );
{
- // Mix and Value and Ref-wrapper containers
-
- typedef typename ref::copy_wrapper<T>::type w_;
- typedef boost::is_reference_wrapper<w_> is_;
-
- // rese to default values
- vt1.resize( vt1.size() );
- vt3.resize( vt3.size() );
-
- T x = -1, y = -1, z = -1;
- boost::array<w_, 3> vw2;
- // Wrappers must bind first!
- vw2[0].rebind( x );
- vw2[1].rebind( y );
- vw2[2].rebind( z );
- boost::copy(
- vt,
- boost::begin(
- vt1 | _chain(
- vw2 | ref::_get // necessary
- ) | _chain( vt3 ) )
- );
- {
- namespace ns = v2::checking::constants;
- ns::do_check(
- vt1[0], vt1[1],
- x, y, z,
- vt3[0], vt3[1], vt3[2]
- );
- }
- // suppresses warning unused
- if(x && y && z){}
- }
- }// runtime checks
- }// do_check
+ BOOST_ASSIGN_V2_CHECK( vt1[0] == vt[0] );
+ BOOST_ASSIGN_V2_CHECK( vt1[1] == vt[1] );
+ BOOST_ASSIGN_V2_CHECK( x == vt[2] );
+ BOOST_ASSIGN_V2_CHECK( y == vt[3] );
+ BOOST_ASSIGN_V2_CHECK( z == vt[4] );
+ BOOST_ASSIGN_V2_CHECK( vt3[0] == vt[5] );
+ BOOST_ASSIGN_V2_CHECK( vt3[1] == vt[6] );
+ BOOST_ASSIGN_V2_CHECK( vt3[2] == vt[7] );
+ }
+ // suppresses warning unused
+ if(x && y && z){}
+ }
+ }// exec
-}// chain
-}// checking
+}// check_chain_aux
}// v2
}// assign
}// boost
Modified: sandbox/assign_v2/boost/assign/v2/utility/chain/short.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/chain/short.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/chain/short.hpp 2011-02-19 05:41:26 EST (Sat, 19 Feb 2011)
@@ -17,7 +17,7 @@
namespace assign{
namespace v2{
-#define MACRO(U1, U2) \
+#define BOOST_ASSIGN_V2_MACRO(U1, U2) \
template<typename R1,typename R2> \
typename chain_aux::result< \
U1, \
@@ -28,11 +28,11 @@
return r1 | _chain( r2 ); \
} \
/**/
-MACRO( R1 , R2 )
-MACRO( R1 , R2 const )
-MACRO( R1 const, R2 )
-MACRO( R1 const, R2 const )
-#undef MACRO
+BOOST_ASSIGN_V2_MACRO( R1 , R2 )
+BOOST_ASSIGN_V2_MACRO( R1 , R2 const )
+BOOST_ASSIGN_V2_MACRO( R1 const, R2 )
+BOOST_ASSIGN_V2_MACRO( R1 const, R2 const )
+#undef BOOST_ASSIGN_V2_MACRO
}// v2
}// assign
Modified: sandbox/assign_v2/boost/assign/v2/utility/convert/check.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/convert/check.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/convert/check.hpp 2011-02-19 05:41:26 EST (Sat, 19 Feb 2011)
@@ -23,7 +23,7 @@
#include <boost/assign/v2/utility/convert/converter.hpp>
#include <boost/assign/v2/utility/convert/deduce.hpp>
#include <boost/assign/v2/utility/convert/predicate.hpp>
-#include <boost/assign/v2/detail/checking/fwd.hpp>
+#include <boost/assign/v2/detail/check/fwd_equal_container.hpp>
// Don't include this file in v2/utility/convert.hpp
// To use it, precede by
@@ -32,23 +32,21 @@
namespace boost{
namespace assign{
namespace v2{
-namespace checking{
-namespace convert{
+namespace check_aux{
- template<typename To, typename From>
- void do_check(From const& from)
+ template<typename C, typename R>
+ void equal_convert(R const& r)
{
- namespace ns = checking::container;
- To to = converter( from );
- ns::do_check( to );
- // ns::do_check( To( converter( from ) ) );
+ C cont = converter( r );
+ namespace ns = v2::check_aux;
+ ns::equal_container( cont, r );
}
- template<typename From>
- void do_check(From const& from)
+ template<typename R>
+ void equal_convert(R const& r)
{
namespace as2 = boost::assign::v2;
- namespace ns = checking::convert;
+ namespace ns = check_aux;
typedef boost::array<int, 8> ar_;
typedef std::deque<int> deque_;
@@ -58,64 +56,63 @@
typedef std::stack<int> stack_;
typedef std::vector<int> vec_;
- BOOST_MPL_ASSERT(( as2::convert_aux::use_put<ar_, From> ));
- BOOST_MPL_ASSERT(( as2::convert_aux::use_put<stack_, From> ));
- BOOST_MPL_ASSERT(( as2::convert_aux::use_put<queue_, From> ));
- BOOST_MPL_ASSERT_NOT(( as2::convert_aux::use_put<deque_, From> ));
- BOOST_MPL_ASSERT_NOT(( as2::convert_aux::use_put<list_, From> ));
- BOOST_MPL_ASSERT_NOT(( as2::convert_aux::use_put<set_, From> ));
- BOOST_MPL_ASSERT_NOT(( as2::convert_aux::use_put<vec_, From> ));
+ BOOST_MPL_ASSERT(( as2::convert_aux::use_put<ar_, R> ));
+ BOOST_MPL_ASSERT(( as2::convert_aux::use_put<stack_, R> ));
+ BOOST_MPL_ASSERT(( as2::convert_aux::use_put<queue_, R> ));
+ BOOST_MPL_ASSERT_NOT(( as2::convert_aux::use_put<deque_, R> ));
+ BOOST_MPL_ASSERT_NOT(( as2::convert_aux::use_put<list_, R> ));
+ BOOST_MPL_ASSERT_NOT(( as2::convert_aux::use_put<set_, R> ));
+ BOOST_MPL_ASSERT_NOT(( as2::convert_aux::use_put<vec_, R> ));
BOOST_MPL_ASSERT(( boost::is_same<
- typename as2::convert_aux::deduce_tag<ar_, From>::type,
+ typename as2::convert_aux::deduce_tag<ar_, R>::type,
convert_tag::put
>
));
BOOST_MPL_ASSERT(( boost::is_same<
- typename as2::convert_aux::deduce_tag<stack_, From>::type,
+ typename as2::convert_aux::deduce_tag<stack_, R>::type,
convert_tag::put
>
));
BOOST_MPL_ASSERT(( boost::is_same<
- typename as2::convert_aux::deduce_tag<queue_, From>::type,
+ typename as2::convert_aux::deduce_tag<queue_, R>::type,
convert_tag::put
>
));
BOOST_MPL_ASSERT(( boost::is_same<
- typename as2::convert_aux::deduce_tag<deque_, From>::type,
+ typename as2::convert_aux::deduce_tag<deque_, R>::type,
convert_tag::copy
>
));
BOOST_MPL_ASSERT(( boost::is_same<
- typename as2::convert_aux::deduce_tag<list_, From>::type,
+ typename as2::convert_aux::deduce_tag<list_, R>::type,
convert_tag::copy
>
));
BOOST_MPL_ASSERT(( boost::is_same<
- typename as2::convert_aux::deduce_tag<set_, From>::type,
+ typename as2::convert_aux::deduce_tag<set_, R>::type,
convert_tag::copy
>
));
BOOST_MPL_ASSERT(( boost::is_same<
- typename as2::convert_aux::deduce_tag<vec_, From>::type,
+ typename as2::convert_aux::deduce_tag<vec_, R>::type,
convert_tag::copy
>
));
- // From is specified in case it is either of those in the lhs below.
- ns::do_check<queue_, From >( from );
- ns::do_check<stack_, From >( from );
- ns::do_check<ar_, From >( from );
-
- ns::do_check<deque_, From >( from );
- ns::do_check<list_, From >( from );
- ns::do_check<set_, From >( from );
- ns::do_check<vec_, From >( from );
+ // R as 2nd arg is explicit in case it is the same as the 1st arg
+ ns::equal_convert<queue_, R >( r );
+ ns::equal_convert<stack_, R >( r );
+ ns::equal_convert<ar_, R >( r );
+
+ ns::equal_convert<deque_, R >( r );
+ ns::equal_convert<list_, R >( r );
+ ns::equal_convert<set_, R >( r );
+ ns::equal_convert<vec_, R >( r );
}
-}// convert
-}// checking
+}// check_aux
}// v2
}// assign
}// boost
Modified: sandbox/assign_v2/boost/assign/v2/utility/convert/converter.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/convert/converter.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/convert/converter.hpp 2011-02-19 05:41:26 EST (Sat, 19 Feb 2011)
@@ -81,6 +81,13 @@
#define BOOST_ASSIGN_V2_CONVERTER_OP(s, data, T) typename T
#endif
#ifndef BOOST_ASSIGN_V2_CONVERTER
+
+// Expanding
+// namespace ns{
+// BOOST_ASSIGN_V2_CONVERTER( cont<A,B,C>, (A)(B)(C) )
+// }
+// creates a name-lookup version of converter() for name ns::cont<A, B, C>
+
#define BOOST_ASSIGN_V2_CONVERTER(U, Seq)\
template<BOOST_PP_SEQ_ENUM(\
BOOST_PP_SEQ_TRANSFORM(\
Modified: sandbox/assign_v2/boost/assign/v2/utility/sub_range.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/sub_range.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/sub_range.hpp 2011-02-19 05:41:26 EST (Sat, 19 Feb 2011)
@@ -1,58 +1 @@
-//////////////////////////////////////////////////////////////////////////////
-// Boost.Assign v2 //
-// //
-// Copyright (C) 2003-2004 Thorsten Ottosen //
-// Copyright (C) 2010 Erwann Rogard //
-// Use, modification and distribution are subject to the //
-// Boost Software License, Version 1.0. (See accompanying file //
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
-//////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_ASSIGN_V2_UTILITY_SUB_RANGE_ER_2010_HPP
-#define BOOST_ASSIGN_V2_UTILITY_SUB_RANGE_ER_2010_HPP
-//#include <boost/range/sub_range.hpp>
-#include <boost/range/begin.hpp>
-#include <boost/range/end.hpp>
-#include <boost/range/iterator.hpp>
-#include <boost/range/iterator_range.hpp>
-
-namespace boost{
-namespace assign{
-namespace v2{
-namespace result_of{
-
- template<typename R>
- struct sub_range
- {
-
- // typedef boost::sub_range<R> type; // Compiler error
- // Workaround:
- typedef typename ::boost::range_iterator<R>::type it_;
- typedef typename ::boost::iterator_range<it_>::type type;
- };
-
-}// result_of
-
- // Use it, for example, to do comparisons:
- // v2::sub_range( ref::csv_array(-1, 0 ,1) ) < r;
-
- template<typename R>
- typename v2::result_of::sub_range<R>::type
- sub_range( R& r)
- {
- typedef typename v2::result_of::sub_range<R>::type result_;
- return result_( boost::begin( r ), boost::end( r ) );
- }
-
- template<typename R>
- typename v2::result_of::sub_range<R const>::type
- sub_range( R const& r)
- {
- typedef typename v2::result_of::sub_range<R const>::type result_;
- return result_( boost::begin( r ), boost::end( r ) );
- }
-
-}// v2
-}// assign
-}// boost
-
-#endif
+// TODO remove file
\ No newline at end of file
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