|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71020 - in sandbox/assign_v2: boost/assign boost/assign/v2/conversion boost/assign/v2/deque boost/assign/v2/deque/cpp03 boost/assign/v2/detail boost/assign/v2/detail/functor boost/assign/v2/detail/traits boost/assign/v2/detail/traits/aux_ boost/assign/v2/interpreter boost/assign/v2/option boost/assign/v2/option/modifier boost/assign/v2/pipe boost/assign/v2/put boost/assign/v2/ref/array boost/assign/v2/ref/aux_ boost/assign/v2/ref/aux_/list boost/assign/v2/ref/aux_/list/array boost/assign/v2/ref/aux_/list/holder libs/assign/v2 libs/assign/v2/src libs/assign/v2/test libs/assign/v2/test/interpreter libs/assign/v2/test/option libs/assign/v2/test/pipe/option libs/assign/v2/test/put libs/assign/v2/test/ref libs/assign/v2/test/ref/aux_
From: erwann.rogard_at_[hidden]
Date: 2011-04-05 21:23:07
Author: e_r
Date: 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
New Revision: 71020
URL: http://svn.boost.org/trac/boost/changeset/71020
Log:
upd assign_v2
Text files modified:
sandbox/assign_v2/boost/assign/v2.hpp | 1
sandbox/assign_v2/boost/assign/v2/conversion/deduce_tag.hpp | 58 ++-------
sandbox/assign_v2/boost/assign/v2/deque/cpp03/csv_deque.hpp | 102 ++++++++++++++-
sandbox/assign_v2/boost/assign/v2/deque/csv_deque.hpp | 140 ++++++++++++++++-----
sandbox/assign_v2/boost/assign/v2/detail/functor/crtp_unary_and_up.hpp | 4
sandbox/assign_v2/boost/assign/v2/detail/keyword.hpp | 3
sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/value_container.hpp | 1
sandbox/assign_v2/boost/assign/v2/detail/traits/container.hpp | 4
sandbox/assign_v2/boost/assign/v2/detail/traits/switch.hpp | 78 +++++++++--
sandbox/assign_v2/boost/assign/v2/interpreter/csv.hpp | 56 ++++----
sandbox/assign_v2/boost/assign/v2/interpreter/data_generator.hpp | 38 +++--
sandbox/assign_v2/boost/assign/v2/interpreter/fwd.hpp | 2
sandbox/assign_v2/boost/assign/v2/interpreter/modifier.hpp | 47 +------
sandbox/assign_v2/boost/assign/v2/option/data_generator.hpp | 93 +++++++-------
sandbox/assign_v2/boost/assign/v2/option/list.hpp | 86 +++++++++----
sandbox/assign_v2/boost/assign/v2/option/modifier/framework.hpp | 2
sandbox/assign_v2/boost/assign/v2/pipe/csv_put.hpp | 14 +-
sandbox/assign_v2/boost/assign/v2/put/csv_put.hpp | 126 +++++++++----------
sandbox/assign_v2/boost/assign/v2/put/delayed_csv_put.hpp | 251 ++++++++++++++++++---------------------
sandbox/assign_v2/boost/assign/v2/put/put.hpp | 39 +++---
sandbox/assign_v2/boost/assign/v2/ref/array/csv_array.hpp | 21 +--
sandbox/assign_v2/boost/assign/v2/ref/aux_/list.hpp | 1
sandbox/assign_v2/boost/assign/v2/ref/aux_/list/array/policy.hpp | 6
sandbox/assign_v2/boost/assign/v2/ref/aux_/list/as_modulo_list.hpp | 100 ---------------
sandbox/assign_v2/boost/assign/v2/ref/aux_/list/container.hpp | 41 ++++-
sandbox/assign_v2/boost/assign/v2/ref/aux_/list/fwd.hpp | 4
sandbox/assign_v2/boost/assign/v2/ref/aux_/list/holder/tail.hpp | 27 ++-
sandbox/assign_v2/libs/assign/v2/src/main.cpp | 12
sandbox/assign_v2/libs/assign/v2/test/conversion.cpp | 11 +
sandbox/assign_v2/libs/assign/v2/test/deque.cpp | 83 ++++++------
sandbox/assign_v2/libs/assign/v2/test/interpreter/modifier.cpp | 6
sandbox/assign_v2/libs/assign/v2/test/option.cpp | 2
sandbox/assign_v2/libs/assign/v2/test/option/data.cpp | 13 +
sandbox/assign_v2/libs/assign/v2/test/option/iterate.cpp | 21 --
sandbox/assign_v2/libs/assign/v2/test/option/list.cpp | 43 ++++--
sandbox/assign_v2/libs/assign/v2/test/option/mapped.cpp | 34 ++--
sandbox/assign_v2/libs/assign/v2/test/option/std_modifier.cpp | 9
sandbox/assign_v2/libs/assign/v2/test/pipe/option/data.cpp | 4
sandbox/assign_v2/libs/assign/v2/test/pipe/option/iterate.cpp | 3
sandbox/assign_v2/libs/assign/v2/test/pipe/option/mapped.cpp | 10
sandbox/assign_v2/libs/assign/v2/test/put/put.cpp | 18 +-
sandbox/assign_v2/libs/assign/v2/test/ref.cpp | 2
sandbox/assign_v2/libs/assign/v2/test/ref/array.cpp | 3
sandbox/assign_v2/libs/assign/v2/test/ref/aux_/list.cpp | 18 +-
sandbox/assign_v2/libs/assign/v2/tutorial.cpp | 7
45 files changed, 854 insertions(+), 790 deletions(-)
Modified: sandbox/assign_v2/boost/assign/v2.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -12,7 +12,6 @@
#include <boost/assign/v2/chain.hpp>
#include <boost/assign/v2/conversion.hpp>
-#include <boost/assign/v2/csv.hpp>
#include <boost/assign/v2/detail.hpp>
#include <boost/assign/v2/deque.hpp>
#include <boost/assign/v2/option.hpp>
Modified: sandbox/assign_v2/boost/assign/v2/conversion/deduce_tag.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/conversion/deduce_tag.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/conversion/deduce_tag.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -20,56 +20,26 @@
namespace assign{
namespace v2{
namespace switch_tag{
- struct deduce_convert{};
+ struct conversion{};
}// switch_tag
-namespace conversion_aux{
-
- // This is in replacement of switch_aux::helper since here we need
- // two arguments.
-
- template<typename T, typename U>
- struct default_f : ::boost::mpl::true_{};
-
- template<typename Tag,
- template<typename, typename> class F = conversion_aux::default_f>
- struct helper
- {
- typedef Tag tag;
- template<typename T> // T must derive from mpl::pair<>
- struct apply
- : F<typename T::first, typename T::second>
- {
- };
- };
-
- template<typename C, typename R>
- struct use_put : ::boost::mpl::or_<
- container_aux::is_array<C>,
- container_aux::has_push_deduced_value<C>
- >{};
-
-}// conversion_aux
-namespace switch_aux{
-
- template<>
- struct case_<switch_tag::deduce_convert, 0> :
- conversion_aux::helper<
- v2::convert_tag::put,
- v2::conversion_aux::use_put
- >{};
- template<>
- struct case_<switch_tag::deduce_convert, 1> :
- conversion_aux::helper<v2::convert_tag::copy>{};
+#define BOOST_ASSIGN_V2_SWITCH_TAG conversion
+BOOST_ASSIGN_V2_SWITCH_CASE(0, container_aux::is_array, convert_tag::put)
+BOOST_ASSIGN_V2_SWITCH_CASE(1, container_aux::has_push_deduced_value, convert_tag::put)
+BOOST_ASSIGN_V2_SWITCH_CASE_DEFAULT(2, convert_tag::copy)
+#undef BOOST_ASSIGN_V2_SWITCH_TAG
-}// switch_aux
namespace conversion_aux{
- template<typename C, typename R>
- struct deduce_tag : v2::switch_aux::result<
- v2::switch_tag::deduce_convert,
- boost::mpl::pair<C, R>
+ template<
+ typename C // Container
+ , typename R // Range
>
+ struct deduce_tag
+ : switch_aux::result<
+ switch_tag::conversion,
+ C
+ >
{};
}// conversion_aux
Modified: sandbox/assign_v2/boost/assign/v2/deque/cpp03/csv_deque.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/deque/cpp03/csv_deque.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/deque/cpp03/csv_deque.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -11,6 +11,7 @@
#define BOOST_ASSIGN_V2_DEQUE_CPP03_CSV_DEQUE_ER_2010_HPP
#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/control/expr_if.hpp>
#include <boost/preprocessor/repetition.hpp>
namespace boost{
@@ -18,29 +19,106 @@
namespace v2{
namespace interpreter_aux{
-#define BOOST_ASSIGN_V2_MACRO1(z, i, data) ( BOOST_PP_CAT(_, i) )
-#define BOOST_ASSIGN_V2_MACRO2(z, N, data)\
+// Explicit T
+#define BOOST_ASSIGN_V2_MACRO(z, N, is_const)\
+ template<typename T BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)>\
+ typename boost::lazy_disable_if<\
+ is_option_crtp<T0>,\
+ result_of::csv_deque<T>\
+ >::type\
+ csv_deque(BOOST_PP_ENUM_BINARY_PARAMS(\
+ N, T, BOOST_PP_EXPR_IF(is_const, const)& _\
+ ))\
+ {\
+ typename result_of::csv_deque<T>::type result;\
+ csv( result BOOST_PP_ENUM_TRAILING_PARAMS(N, _) );\
+ return result;\
+ }\
+ template<\
+ typename T, typename O\
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)\
+ >\
+ typename boost::lazy_enable_if<\
+ is_option_crtp<O>,\
+ result_of::csv_deque_option<O, T>\
+ >::type\
+ csv_deque(\
+ O const& options\
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(\
+ N, T, BOOST_PP_EXPR_IF(is_const, const)& _\
+ ))\
+ {\
+ typedef typename result_of::csv_deque<T>::type before_op_;\
+ typedef typename result_of::csv_deque_option<O, T>::type result_;\
+ result_ result = before_op_() % options;\
+ csv( result BOOST_PP_ENUM_TRAILING_PARAMS(N, _) );\
+ return result;\
+ }\
+/**/
+
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO,
+ 0
+)
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO,
+ 1
+)
+#undef BOOST_ASSIGN_V2_MACRO
+
+// Implicit T
+#define BOOST_ASSIGN_V2_PAR_LIST(z, N, data) data
+#define BOOST_ASSIGN_V2_MACRO(z, N, is_const)\
template<typename T>\
- typename result_of::csv_deque<T>::type\
- csv_deque( BOOST_PP_ENUM_PARAMS(N, T const & _) )\
+ typename boost::lazy_disable_if<\
+ is_option_crtp<T>,\
+ result_of::csv_deque<T>\
+ >::type\
+ csv_deque(\
+ BOOST_PP_ENUM_PARAMS(N, T BOOST_PP_EXPR_IF(is_const, const) & _)\
+ )\
{\
- typedef typename result_of::csv_deque<T>::type result_;\
- return result_() BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO1, ~ );\
+ return csv_deque<T, BOOST_PP_ENUM( N, BOOST_ASSIGN_V2_PAR_LIST, T)>(\
+ BOOST_PP_ENUM_PARAMS(N, _)\
+ );\
+ }\
+ template<typename O, typename T>\
+ typename boost::lazy_enable_if<\
+ is_option_crtp<O>,\
+ result_of::csv_deque_option<O, T>\
+ >::type\
+ csv_deque(\
+ O const& options,\
+ BOOST_PP_ENUM_PARAMS(N, T BOOST_PP_EXPR_IF(is_const, const) & _)\
+ )\
+ {\
+ return csv_deque<T, O, BOOST_PP_ENUM( N, BOOST_ASSIGN_V2_PAR_LIST, T )>(\
+ options,\
+ BOOST_PP_ENUM_PARAMS(N, _)\
+ );\
}\
/**/
BOOST_PP_REPEAT_FROM_TO(
1,
BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
- BOOST_ASSIGN_V2_MACRO2,
- ~
+ BOOST_ASSIGN_V2_MACRO,
+ 0
+)
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO,
+ 1
)
-#undef BOOST_ASSIGN_V2_MACRO1
-#undef BOOST_ASSIGN_V2_MACRO2
+#undef BOOST_ASSIGN_V2_PAR_LIST
+#undef BOOST_ASSIGN_V2_MACRO
}// interpreter_aux
-
using interpreter_aux::csv_deque;
-
}// v2
}// assign
}// boost
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-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -12,8 +12,12 @@
#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
#include <boost/assign/v2/detail/pp/ignore.hpp>
#include <boost/assign/v2/deque/deque.hpp>
+#include <boost/assign/v2/interpreter/csv.hpp>
+#include <boost/assign/v2/option/list.hpp>
#include <boost/type_traits/decay.hpp>
#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/enable_if.hpp>
#if BOOST_ASSIGN_V2_ENABLE_CPP0X
#include <utility>
#endif
@@ -21,68 +25,131 @@
namespace boost{
namespace assign{
namespace v2{
+//[syntax_deque_csv_deque
namespace interpreter_aux{
template<typename T>
- struct csv_deque_value : boost::decay<
- typename boost::remove_cv<T>::type
- >{};
+ struct csv_deque_deduce_value/*<-*/ : boost::decay<
+ typename boost::remove_cv<
+ typename boost::remove_reference<T>::type
+ >::type
+ >{}/*->*/;
namespace result_of{
template<typename T>
- struct csv_deque: result_of::deque<
- typename csv_deque_value<T>::type
- >{};
-
-}// result_of
-}// interpreter_aux
-//[syntax_deque_csv_deque
+ struct csv_deque/*<-*/
+ : result_of::deque<
+ typename csv_deque_deduce_value<T>::type
+ >
+ {}/*->*/;
- template<typename T>
- struct csv_deque_value/*<-*/
- : interpreter_aux::csv_deque_value<T>
+ template<typename Os, typename T>
+ struct csv_deque_option/*<-*/
+ : modulo_result<
+ typename result_of::csv_deque<T>::type,
+ Os
+ >
{}/*->*/;
-namespace result_of{
+}// result_of
template<typename T>
- struct csv_deque/*<-*/
- : interpreter_aux::result_of::csv_deque<T>
- {}/*->*/;
+ typename result_of::csv_deque<T>::type
+ csv_deque()/*<-*/{
+ return typename result_of::csv_deque<T>::type();
+ }/*->*/;
-}// result_of
//<-
#if BOOST_ASSIGN_V2_ENABLE_CPP0X
-namespace interpreter_aux{
-
- template<typename T, typename R>
- void csv_deque_impl(R& r){}
+//->
+
+ // Explicit T
+
+ template<typename T, typename U, typename... Args>
+ typename boost::lazy_disable_if<
+ is_option_crtp_cpp0x<U>,
+ result_of::csv_deque<T>
+ >::type
+ csv_deque(U&& u, Args&& ... args)/*<-*/
+ {
+ typename result_of::csv_deque<T>::type result;
+ csv( result, std::forward<U>( u ), std::forward<Args>( args )... );
+ return result;
+ }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
- template<typename T, typename R, typename...Args>
- void csv_deque_impl(R& r, T const& t, Args&&...args)
+ template<typename T, typename O, typename... Args>
+ typename boost::lazy_enable_if<
+ is_option_crtp<O>,
+ result_of::csv_deque_option<O, T>
+ >::type
+ csv_deque(O const& options, Args&& ... args)/*<-*/
{
- r( t );
- csv_deque_impl<T>(r, std::forward<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 )... );
+ return result;
+ }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+ // Implicit T
+
template<typename T, typename... Args>
- typename result_of::csv_deque<T>::type
- csv_deque(const T& t, Args const& ... args)/*<-*/
+ typename boost::lazy_disable_if<
+ is_option_crtp_cpp0x<T>,
+ result_of::csv_deque<T>
+ >::type
+ csv_deque(T&& t, Args&& ... args)/*<-*/
{
- typename result_of::csv_deque<T>::type result;
- csv_deque_impl<T>(result, t, args...);
- return result;
+ csv_deque<T>(
+ std::forward<T>( t ),
+ std::forward<Args>( args )...
+ );
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
-//]
-}// interpreter_aux
+ 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(/*->*/;/*<-*/)/*->*/
-using interpreter_aux::csv_deque;
+//<-
+#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
+//->
+}// interpreter_aux
+//<-
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+//->
+ using interpreter_aux::csv_deque;
+//<-
#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
+//->
+
+namespace result_of{
+
+ template<typename T>
+ struct csv_deque/*<-*/
+ : interpreter_aux::result_of::csv_deque<T>
+ {}/*->*/;
+ template<typename Os, typename T>
+ struct csv_deque_option/*<-*/
+ : interpreter_aux::result_of::csv_deque_option<Os, T>
+ {}/*->*/;
+
+}// result_of
+
+//]
}// v2
}// assign
}// boost
@@ -91,5 +158,4 @@
#include <boost/assign/v2/deque/cpp03/csv_deque.hpp>
#endif
-
#endif // BOOST_ASSIGN_V2_DEQUE_CSV_DEQUE_ER_2010_HPP
Modified: sandbox/assign_v2/boost/assign/v2/detail/functor/crtp_unary_and_up.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/functor/crtp_unary_and_up.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/functor/crtp_unary_and_up.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -84,10 +84,6 @@
} \
/**/
-// TODO remove
-// return this->derived().template impl<BOOST_ASSIGN_V2_TPL_ARG_LIST(SeqU)>( \
-
-
#define BOOST_ASSIGN_V2_MACRO2(z, n, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT(\
BOOST_ASSIGN_V2_MACRO1, \
BOOST_PP_SEQ_FIRST_N(BOOST_PP_INC(n), BOOST_ASSIGN_V2_SEQ_TPL_BINARY_ARG_LIST)\
Modified: sandbox/assign_v2/boost/assign/v2/detail/keyword.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/keyword.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/keyword.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -22,6 +22,7 @@
};
struct element/*<-*/{}/*->*/;
struct key/*<-*/{}/*->*/;
+ struct map/*<-*/{}/*->*/;
struct nil/*<-*/{}/*->*/;
struct use_default/*<-*/{}/*->*/;
struct value/*<-*/{}/*->*/;
@@ -30,6 +31,7 @@
typedef keyword_aux::ignore ignore_;
typedef keyword_aux::element element_;
typedef keyword_aux::key key_;
+ typedef keyword_aux::map map_;
typedef keyword_aux::nil nil_;
typedef keyword_aux::use_default use_default_;
typedef keyword_aux::value value_;
@@ -37,6 +39,7 @@
const ignore_ _ignore/*<-*/ = ignore_()/*->*/;
const element_ _element/*<-*/ = element_()/*->*/;
const key_ _key/*<-*/ = key_()/*->*/;
+ const map_ _map/*<-*/ = map_()/*->*/;
const nil_ _nil/*<-*/ = nil_()/*->*/;
const use_default_ _use_default/*<-*/ = use_default_()/*->*/;
const value_ _value/*<-*/ = value_()/*->*/;
Modified: sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/value_container.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/value_container.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/value_container.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -12,6 +12,7 @@
#include <boost/assign/v2/detail/traits/aux_/fwd_container.hpp>
#include <boost/config.hpp>
#include <boost/mpl/bool.hpp>
+#include <boost/multi_array/base.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/seq.hpp>
#include <boost/type_traits/add_const.hpp>
Modified: sandbox/assign_v2/boost/assign/v2/detail/traits/container.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/traits/container.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/traits/container.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -83,6 +83,10 @@
: through_value_container<value_is_map, C>
{};
+ template<typename C> struct is_multi_array
+ : through_value_container<value_is_multi_array, C>
+ {};
+
template<typename C>
struct is_ptr_container : ::boost::mpl::not_<
boost::is_same<C, typename to_value_container<C>::type>
Modified: sandbox/assign_v2/boost/assign/v2/detail/traits/switch.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/traits/switch.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/traits/switch.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -23,37 +23,79 @@
}//switch_tag
namespace switch_aux{
- // Fully specialize by inheriting from wrap<Tag,F>
- // To terminate the switch, inherit from wrap<Tag>
- template<typename SwitchTag, int k> struct case_{};
+ template<typename SwitchTag, int CaseNumber> struct case_
+ {
+ // Specialize like this:
+ // template<>
+ // struct case_<SwitchTag, CaseNumber> : helper<Value, Predicate>{};
+ };
- template<typename T>
- struct default_f : ::boost::mpl::true_{};
+ template<typename Expression>
+ struct always_true_
+ : ::boost::mpl::true_
+ {};
- template<typename Tag, template<typename> class F = switch_aux::default_f>
+ template<typename Value, template<typename> class Predicate = always_true_>
struct helper
{
- typedef Tag tag;
- template<typename T> struct apply : F<T>
- {
- // Is Tag compatible with T? Answer : F<T>::value.
- };
+ typedef Value value;
+
+ template<typename Expression>
+ struct apply
+ : Predicate<Expression>
+ {};
+
};
- template<typename H> // helper
- struct extract_tag
+ template<typename Helper>
+ struct extract_value
{
- typedef typename H::tag type;
+ typedef typename Helper::value type;
};
- template<typename SwitchTag, typename T, int k = 0>
+ template<typename SwitchTag, typename Expression, int CaseNumber = 0>
struct result : ::boost::mpl::eval_if<
- ::boost::mpl::apply1< switch_aux::case_<SwitchTag, k>, T >,
- switch_aux::extract_tag< switch_aux::case_<SwitchTag, k> >,
- switch_aux::result< SwitchTag, T, k + 1>
+ ::boost::mpl::apply1<
+ switch_aux::case_<SwitchTag, CaseNumber>,
+ Expression
+ >,
+ switch_aux::extract_value<
+ switch_aux::case_<SwitchTag, CaseNumber>
+ >,
+ switch_aux::result<
+ SwitchTag, Expression, CaseNumber + 1
+ >
>{};
}// switch_aux
+
+#define BOOST_ASSIGN_V2_SWITCH_CASE(CaseNumber, BooleanMetaF, Value)\
+namespace switch_aux{\
+ template<>\
+ struct case_<switch_tag::BOOST_ASSIGN_V2_SWITCH_TAG, CaseNumber>\
+ : switch_aux::helper<\
+ Value,\
+ BooleanMetaF\
+ >{};\
+}\
+/**/
+
+#define BOOST_ASSIGN_V2_SWITCH_CASE_DEFAULT(CaseNumber, Value)\
+namespace switch_aux{\
+ template<>\
+ struct case_<switch_tag::BOOST_ASSIGN_V2_SWITCH_TAG, CaseNumber>\
+ : switch_aux::helper<Value>\
+ {};\
+}\
+/**/
+
+// Usage:
+// #define BOOST_ASSIGN_V2_SWITCH_TAG unspecified
+// for i = 0,...,n-1
+// BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_CASE(i, Fi, Valuei)
+// and
+// BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_CASE(n, Valuen)
+
}// v2
}// assign
}// boost
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-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -18,7 +18,9 @@
#include <utility>
#else
#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/control/expr_if.hpp>
#include <boost/preprocessor/repetition.hpp>
#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
@@ -28,66 +30,60 @@
//[syntax_interpreter_csv
namespace interpreter_aux{
+//<-
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+//->
+
template<typename C, typename F, typename MTag, typename DTag, typename D>
void csv(
interpreter_crtp<C, F, MTag, DTag, D> const& interpreter
)/*<-*/
{
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
-
-//<-
-#if BOOST_ASSIGN_V2_ENABLE_CPP0X
-//->
-
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
)/*<-*/
{
- return csv( interpreter( t ), std::forward<Args>( args )... );
+ return csv(
+ interpreter( std::forward<T>( t ) ),
+ std::forward<Args>( args )...
+ );
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
//]
#else
-#define BOOST_ASSIGN_V2_MACRO1(z, i, data) BOOST_PP_CAT(T, i) data
-#define BOOST_ASSIGN_V2_MACRO2(z, i, data) ( BOOST_PP_CAT(_, i) )
-#define BOOST_ASSIGN_V2_MACRO3(z, N, data)\
-\
- template<\
- typename C, typename F, typename MTag, typename DTag, typename D\
- BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)\
- >\
- void csv( \
- interpreter_crtp<C, F, MTag, DTag, D> const& interpreter\
- BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, T, & _)\
- )\
- {\
- interpreter BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO2, ~ );\
- }\
-\
+#define BOOST_ASSIGN_V2_MACRO1(z, i, data) ( BOOST_PP_CAT(_, i) )
+#define BOOST_ASSIGN_V2_MACRO2(z, N, is_const)\
template<\
typename C, typename F, typename MTag, typename DTag, typename D\
BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)\
>\
- void csv( \
+ void csv(\
interpreter_crtp<C, F, MTag, DTag, D> const& interpreter\
- BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, T, const & _)\
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(\
+ N, T, BOOST_PP_EXPR_IF(is_const, const) & _\
+ )\
)\
{\
- interpreter BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO2, ~ );\
+ interpreter BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO1, ~ );\
}\
-\
/**/
+
BOOST_PP_REPEAT_FROM_TO(
- 1,
+ 1, // otherwise redefintion of csv()
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO2,
+ 0
+)
+BOOST_PP_REPEAT(
BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
- BOOST_ASSIGN_V2_MACRO3,
- ~
+ BOOST_ASSIGN_V2_MACRO2,
+ 1
)
#undef BOOST_ASSIGN_V2_MACRO1
#undef BOOST_ASSIGN_V2_MACRO2
-#undef BOOST_ASSIGN_V2_MACRO3
#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
}// interpreter_aux
Modified: sandbox/assign_v2/boost/assign/v2/interpreter/data_generator.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/interpreter/data_generator.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/data_generator.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -9,35 +9,41 @@
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_ASSIGN_V2_INTERPRETER_DATA_ER_2010_HPP
#define BOOST_ASSIGN_V2_INTERPRETER_DATA_ER_2010_HPP
+#include <boost/assign/v2/detail/traits/container.hpp>
+#include <boost/assign/v2/detail/traits/switch.hpp>
#include <boost/assign/v2/detail/functor/pair.hpp>
#include <boost/assign/v2/detail/functor/value.hpp>
#include <boost/assign/v2/interpreter/fwd.hpp>
+#include <boost/assign/v2/option/data_generator.hpp>
namespace boost{
namespace assign{
namespace v2{
-//[syntax_interpreter_data
+//[syntax_interpreter_data_generator
+namespace switch_tag{
+ struct data_generator{};
+}// switch_tag
+
+#define BOOST_ASSIGN_V2_SWITCH_TAG data_generator
+BOOST_ASSIGN_V2_SWITCH_CASE(0, container_aux::is_multi_array, element_)
+BOOST_ASSIGN_V2_SWITCH_CASE(1, container_aux::is_map, map_)
+BOOST_ASSIGN_V2_SWITCH_CASE_DEFAULT(2, value_)
+#undef BOOST_ASSIGN_V2_SWITCH_TAG
+
namespace interpreter_aux{
template<
typename C // Value or pointer-container
- , typename T
- , bool is_map
>
struct deduce_data_generator/*<-*/
- {
- typedef v2::functor_aux::value<T> type;
- }/*->*/;
-
- template<typename C, typename T>
- struct deduce_data_generator<C, T, true>/*<-*/
- {
- typedef v2::functor_aux::pair<
- T,
- typename container_aux::key<C>::type,
- typename container_aux::mapped<C>::type
- > type;
- }/*->*/;
+ : data_generator<
+ C,
+ typename switch_aux::result<
+ switch_tag::data_generator,
+ C
+ >::type
+ >
+ {}/*->*/;
}// interpreter_aux
//]
Modified: sandbox/assign_v2/boost/assign/v2/interpreter/fwd.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/interpreter/fwd.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/fwd.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -39,8 +39,6 @@
template<
typename C // Value or pointer-container
- , typename T = typename v2::container_aux::value<C>::type
- , bool is_map = v2::container_aux::is_map<C>::value
>
struct deduce_data_generator;
Modified: sandbox/assign_v2/boost/assign/v2/interpreter/modifier.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/interpreter/modifier.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/modifier.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -60,46 +60,15 @@
/*<-*/
namespace switch_tag{
- struct deduce_put{};
+ struct modifier_tag{};
}// switch_tag
-#ifdef BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_CASE
-#error
-#else
-#define BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_CASE(Tag, BooleanMetaF, CaseNumber)\
-namespace switch_aux{\
- template<>\
- struct case_<switch_tag::deduce_put, CaseNumber> :\
- switch_aux::helper<\
- v2::modifier_tag::Tag,\
- BooleanMetaF\
- >{};\
-}\
-/**/
-#endif
-
-#ifdef BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_DEFAULT
-#error
-#else
-#define BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_DEFAULT(CaseNumber)\
-namespace switch_aux{\
- template<>\
- struct case_<switch_tag::deduce_put, CaseNumber> :\
- switch_aux::helper<v2::modifier_tag::push_back>\
- {};\
-}\
-/**/
-#endif
-
-#ifdef BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH
-#warning
-#else
-BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_CASE(insert, container_aux::is_associative, 0)
-BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_CASE(iterate<>, container_aux::is_array, 1)
-BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_CASE(push, container_aux::has_push_deduced_value, 2)
-BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH_DEFAULT(3)
-#define BOOST_ASSIGN_V2_OPTION_MODIFIER_SWITCH
-#endif
+#define BOOST_ASSIGN_V2_SWITCH_TAG modifier_tag
+BOOST_ASSIGN_V2_SWITCH_CASE( 0, container_aux::is_associative, modifier_tag::insert )
+BOOST_ASSIGN_V2_SWITCH_CASE( 1, container_aux::is_array, modifier_tag::iterate<> )
+BOOST_ASSIGN_V2_SWITCH_CASE( 2, container_aux::has_push_deduced_value, modifier_tag::push )
+BOOST_ASSIGN_V2_SWITCH_CASE_DEFAULT( 3, modifier_tag::push_back )
+#undef BOOST_ASSIGN_V2_SWITCH_TAG
/*->*/
namespace interpreter_aux{
@@ -108,7 +77,7 @@
typename C // Container
>
struct deduce_modifier_tag/*<-*/
- : switch_aux::result< switch_tag::deduce_put, C>
+ : switch_aux::result< switch_tag::modifier_tag, C>
{}/*->*/;
//<-
Modified: sandbox/assign_v2/boost/assign/v2/option/data_generator.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/option/data_generator.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/option/data_generator.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -13,7 +13,6 @@
#include <boost/assign/v2/detail/keyword.hpp>
#include <boost/assign/v2/detail/pp/ignore.hpp>
#include <boost/assign/v2/detail/traits/container.hpp>
-#include <boost/assign/v2/interpreter/data_generator.hpp>
#include <boost/assign/v2/interpreter/fwd.hpp>
#include <boost/assign/v2/interpreter/replace.hpp>
#include <boost/assign/v2/option/list.hpp>
@@ -30,7 +29,7 @@
typename C // Value or pointer-container
, typename F // Functor or keyword
>
- struct deduce_generator/*<-*/
+ struct data_generator/*<-*/
{
typedef F type;
}/*->*/;
@@ -38,27 +37,35 @@
template<
typename C // Multi-array
>
- struct deduce_generator<C, element_>/*<-*/
+ struct data_generator<C, element_>/*<-*/
{
- typedef functor_aux::value<
- typename container_aux::element<C>::type
- > type;
+ typedef typename container_aux::element<C>::type element_;
+ typedef functor_aux::value<element_> type;
}/*->*/;
template<typename C>
- struct deduce_generator<C, key_>/*<-*/
+ struct data_generator<C, key_>/*<-*/
{
typedef typename container_aux::key<C>::type key_;
typedef functor_aux::value<key_> type;
}/*->*/;
template<typename C>
- struct deduce_generator<C, use_default_>/*<-*/
+ struct data_generator<C, map_>/*<-*/
+ {
+ typedef typename container_aux::key<C>::type key_;
+ typedef typename container_aux::mapped<C>::type mapped_;
+ typedef typename container_aux::value<C>::type value_;
+ typedef functor_aux::pair<value_, key_, mapped_> type;
+ }/*->*/;
+
+ template<typename C>
+ struct data_generator<C, use_default_>/*<-*/
: deduce_data_generator<C>
{}/*->*/;
template<typename C>
- struct deduce_generator<C, value_>/*<-*/
+ struct data_generator<C, value_>/*<-*/
{
typedef functor_aux::value<
typename container_aux::value<C>::type
@@ -71,7 +78,7 @@
struct option_data_generator/*<-*/
: ::boost::mpl::apply1<
interpreter_aux::replace_data_generator<D>,
- typename deduce_generator<C, F>::type
+ typename data_generator<C, F>::type
>
{}/*->*/;
@@ -79,7 +86,7 @@
template<typename F/*<-*/= ignore_/*->*/>
struct option_data_generator/*<-*/
- : option_listable<
+ : option_crtp<
option_data_generator<F>
>
{
@@ -87,58 +94,50 @@
option_data_generator(F f) : f_( f ){}
template<typename C>
- F const& data_generator()const{ return this->f_; }
+ F const& get()const{ return this->f_; }
private:
F f_;
}/*->*/;
+//<-
template<typename Kwd>
struct option_data_generator_helper
+ : option_crtp<
+ option_data_generator<Kwd>
+ >
{
-
template<typename C>
- typename deduce_generator<C, Kwd>::type
- data_generator()const
+ typename data_generator<C, Kwd>::type
+ get()const
{
- return typename deduce_generator<C, Kwd>::type();
+ return typename data_generator<C, Kwd>::type();
}
-
};
- template<>
- struct option_data_generator<use_default_>/*<-*/
- : option_data_generator_helper<use_default_>
- {
- option_data_generator(){}
- option_data_generator(ignore_){}
-
- }/*->*/;
-
- template<>
- struct option_data_generator<key_>/*<-*/
- : option_data_generator_helper<key_>
- {
- option_data_generator(){}
- option_data_generator(ignore_){}
-
- }/*->*/;
-
- template<>
- struct option_data_generator<value_>/*<-*/
- : option_data_generator_helper<value_>
- {
- option_data_generator(){}
- option_data_generator(ignore_){}
-
- }/*->*/;
+#define BOOST_ASSIGN_V2_MACRO(Kwd)\
+ template<>\
+ struct option_data_generator<Kwd>\
+ : option_data_generator_helper<Kwd>\
+ {\
+ option_data_generator(){}\
+ option_data_generator(ignore_){}\
+ };\
+/**/
+BOOST_ASSIGN_V2_MACRO(element_)
+BOOST_ASSIGN_V2_MACRO(key_)
+BOOST_ASSIGN_V2_MACRO(map_)
+BOOST_ASSIGN_V2_MACRO(use_default_)
+BOOST_ASSIGN_V2_MACRO(value_)
+#undef BOOST_ASSIGN_V2_MACRO
+//->
// Overrides data generator
- template<typename C, typename F, typename ModifierTag
- , typename DataTag, typename D, typename F1>
+ template<typename C, typename F, typename MTag
+ , typename DTag, typename D, typename F1>
typename result_of::option_data_generator<D, C, F1>::type
operator%(
- interpreter_crtp<C, F, ModifierTag, DataTag, D> const& lhs,
+ interpreter_crtp<C, F, MTag, DTag, D> const& lhs,
option_data_generator<F1> const& rhs
)/*<-*/
{
@@ -147,7 +146,7 @@
>::type result_;
return result_(
lhs.container(),
- rhs.template data_generator<C>(),
+ rhs.template get<C>(),
lhs.modifier
);
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
Modified: sandbox/assign_v2/boost/assign/v2/option/list.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/option/list.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/option/list.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -14,6 +14,7 @@
#include <boost/mpl/bool.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
+#include <boost/mpl/or.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/is_same.hpp>
@@ -41,7 +42,7 @@
};
template<typename Head>
- struct option_list_exit
+ struct list_option_exit
: boost::is_same<Head, nil_>
{};
@@ -51,7 +52,7 @@
typename Head,
typename Tail,
typename Lhs,
- bool exit = option_list_exit<Head>::value
+ bool exit = list_option_exit<Head>::value
>
struct apply_list_option
{
@@ -69,27 +70,74 @@
>
struct apply_list_option<Head, Tail, Lhs, true>
{
- typedef Lhs type;
+ typedef Lhs const& type;
};
}// result_of
- struct list_option_base{};
-
+ template<typename O, bool is_list = false>
+ struct option_crtp{};
+
+ template<typename O>
+ struct is_option_crtp
+ : boost::mpl::or_<
+ boost::is_base_of< option_crtp<O, false>, O>,
+ boost::is_base_of< option_crtp<O, true>, O>
+ >
+ {};
+
+ template<
+ typename O // O&&, O&
+ >
+ struct is_option_crtp_cpp0x : is_option_crtp<
+ typename boost::remove_cv<
+ typename boost::remove_reference<O>::type
+ >::type
+ >{};
+
template<
typename Head = nil_,
- typename Tail = list_option_base,
- bool exit = option_list_exit<Head>::value
+ typename Tail = nil_,
+ bool exit = list_option_exit<Head>::value
>
- struct list_option : public Tail
+ struct list_option;
+
+ template<typename Head, typename Tail, bool exit>
+ struct list_option_inherit
+ : Tail
+ {
+ list_option_inherit(){}
+ list_option_inherit( Tail tail )
+ : Tail( tail )
+ {}
+ };
+
+ template<typename Head, typename Tail>
+ struct list_option_inherit<Head, Tail, true>
+ : Tail,
+ option_crtp<
+ list_option<Head, Tail, true>,
+ true
+ >
+ {
+ list_option_inherit(){}
+ list_option_inherit( Tail tail )
+ : Tail( tail )
+ {}
+ };
+
+ template<typename Head, typename Tail, bool exit>
+ struct list_option
+ : list_option_inherit<Head, Tail, exit>
{
+ typedef list_option_inherit<Head, Tail, exit> super_t;
typedef Head head_type;
typedef Tail tail_type;
list_option(){ /*exit = true*/ }
list_option(Tail tail, Head h)
- : Tail( tail ), head_( h )
+ : super_t( tail ), head_( h )
{}
template<typename O>
@@ -141,7 +189,7 @@
list_option<H, T> const& list
)
{
- return list.apply( lhs );
+ return list.apply( static_cast<D const&>( lhs ) );
}
namespace result_of{
@@ -159,12 +207,6 @@
= interpreter_aux::empty_list_option();
}
namespace interpreter_aux{
-
- template<typename O>
- struct option_listable
- : list_option_base
- {};
-
namespace result_of{
template<typename O1, typename O2>
@@ -182,22 +224,12 @@
template<typename O1, typename O2>
typename result_of::option_modulo<O1, O2>::type
- operator%(option_listable<O1> const option1, O2 const& option2)
+ operator%(option_crtp<O1, false> const option1, O2 const& option2)
{
O1 const& ref = static_cast<O1 const&>( option1 );
return _list_option % ref % option2;
}
- template<typename Os>
- struct is_option_listable
- : boost::is_base_of<
- list_option_base,
- typename boost::remove_cv<
- typename boost::remove_reference<Os>::type
- >::type
- >
- {};
-
}// interpreter_aux
}// v2
}// assign
Modified: sandbox/assign_v2/boost/assign/v2/option/modifier/framework.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/option/modifier/framework.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/option/modifier/framework.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -28,7 +28,7 @@
, typename Arg /*<-*/= ignore_/*->*/ // Specifies an aspect of the implementation
>
struct option_modifier/*<-*/
- : option_listable<
+ : option_crtp<
option_modifier<Keyword, Arg>
>
/*->*/
Modified: sandbox/assign_v2/boost/assign/v2/pipe/csv_put.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/pipe/csv_put.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/pipe/csv_put.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -79,17 +79,17 @@
: list_option_( t, h )
{}
- template<typename Option>
+ template<typename O>
struct modulo_result
{
- typedef arg_list_generator<Option, arg_list_generator> type;
+ typedef arg_list_generator<O, arg_list_generator> type;
};
- template<typename Option>
- typename modulo_result<Option>::type
- operator%(Option option)const
+ template<typename O>
+ typename modulo_result<O>::type
+ operator%(O option)const
{
- typedef typename modulo_result<Option>::type result_;
+ typedef typename modulo_result<O>::type result_;
return result_( *this, option );
}
@@ -104,7 +104,7 @@
typedef typename result<0>::type result_;
return result_(
*this,
- ref::csv_array<na_>( _nil )
+ ref::csv_array<na_>()
);
}
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-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -21,7 +21,7 @@
#include <utility>
#else
#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
-#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/control.hpp>
#include <boost/preprocessor/repetition.hpp>
#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
@@ -32,12 +32,12 @@
namespace interpreter_aux{
template<typename F>
- struct csv_suitable
+ struct csv_ready
: ::boost::mpl::true_
{};
template<typename T, typename K, typename M>
- struct csv_suitable<
+ struct csv_ready<
functor_aux::pair<T, K, M>
>
: ::boost::mpl::false_
@@ -46,29 +46,29 @@
namespace result_of{
template<typename C, typename F, typename MTag, typename DTag>
- struct if_make_csv_suitable : ::boost::mpl::identity<
+ struct if_csv_ready : ::boost::mpl::identity<
put_interpreter<C, F, MTag, DTag>
>
{};
template<typename C, typename F, typename MTag, typename DTag>
- struct else_make_csv_suitable : result_of::option_data_generator<
+ struct else_csv_ready : result_of::option_data_generator<
put_interpreter<C, F, MTag, DTag>, C, value_
>
{};
template<typename C, typename F, typename MTag, typename DTag>
- struct make_csv_suitable : ::boost::mpl::eval_if<
- csv_suitable<F>,
- if_make_csv_suitable<C, F, MTag, DTag>,
- else_make_csv_suitable<C, F, MTag, DTag>
+ struct make_csv_ready : ::boost::mpl::eval_if<
+ csv_ready<F>,
+ if_csv_ready<C, F, MTag, DTag>,
+ else_csv_ready<C, F, MTag, DTag>
>{};
}// result_of
template<typename C, typename F, typename MTag, typename DTag>
- typename result_of::if_make_csv_suitable<C, F, MTag, DTag>::type
- make_csv_suitable(
+ typename result_of::if_csv_ready<C, F, MTag, DTag>::type
+ make_csv_ready(
put_interpreter<C, F, MTag, DTag> const& interpreter,
boost::mpl::true_ suitable
)
@@ -77,8 +77,8 @@
}
template<typename C, typename F, typename MTag, typename DTag>
- typename result_of::else_make_csv_suitable<C, F, MTag, DTag>::type
- make_csv_suitable(
+ typename result_of::else_csv_ready<C, F, MTag, DTag>::type
+ make_csv_ready(
put_interpreter<C, F, MTag, DTag> const& interpreter,
boost::mpl::false_ suitable
)
@@ -87,97 +87,89 @@
}
template<typename C, typename F, typename MTag, typename DTag>
- typename result_of::make_csv_suitable<C, F, MTag, DTag>::type
- make_csv_suitable( put_interpreter<C, F, MTag, DTag> const& interpreter)
+ 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_suitable(
+ return make_csv_ready(
interpreter,
- typename csv_suitable<F>::type()
+ typename csv_ready<F>::type()
);
}
- template<typename C>
- void csv_put( C& cont ){}
-
//<-
#if BOOST_ASSIGN_V2_ENABLE_CPP0X
//->
- template<typename C, typename T, typename Args>
- typename boost::disable_if< is_option_listable<T> >::type
- csv_put( C& cont, T&& t, 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_suitable( put( cont ) ),
- std::forward<T>( t ),
+ make_csv_ready(
+ put( cont ) % options
+ ),
std::forward<Args>( args )...
);
}
- template<typename C, typename Options, typename Args>
- typename boost::enable_if< is_option_listable<Options> >::type
- csv_put( C& cont, Options&& options, Args&&... args)
+ template<typename C, typename Args>
+ typename boost::disable_if<
+ is_option_crtp<O>
+ >::type csv_put( C& cont, Args&&... args)
{
csv(
- make_csv_suitable(
- options.apply( put( cont ) )
- ),
+ make_csv_ready( put( cont ) ),
std::forward<Args>( args )...
);
}
//]
#else
-#define BOOST_ASSIGN_V2_MACRO1(z, i, data) BOOST_PP_CAT(T, i) data
-#define BOOST_ASSIGN_V2_MACRO2(z, i, data) ( BOOST_PP_CAT(_, i) )
-#define BOOST_ASSIGN_V2_MACRO3(z, N, data)\
- template<typename C, BOOST_PP_ENUM_PARAMS(N, typename T)>\
- typename boost::disable_if< is_option_listable<T0> >::type\
- csv_put( C& cont, BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _) )\
- {\
- csv(\
- make_csv_suitable( put( cont ) ) \
- , BOOST_PP_ENUM_PARAMS(N, _)\
- );\
- }\
- template<typename C, typename Os, BOOST_PP_ENUM_PARAMS(N, typename T)>\
- typename boost::enable_if< is_option_listable<Os> >::type\
- csv_put( C& cont, Os const& options, BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _) )\
+
+ template<typename C>
+ void csv_put( C& cont ){}
+
+#define BOOST_ASSIGN_V2_MACRO(z, N, is_const)\
+ template<typename C, typename O, BOOST_PP_ENUM_PARAMS(N, typename T)>\
+ typename boost::enable_if<\
+ is_option_crtp<O>\
+ >::type csv_put(\
+ C& cont, O const& options,\
+ BOOST_PP_ENUM_BINARY_PARAMS(N, T, BOOST_PP_EXPR_IF(is_const, const)& _)\
+ )\
{\
csv(\
- make_csv_suitable( put( cont ) % options ) \
+ make_csv_ready( put( cont ) % options ) \
, BOOST_PP_ENUM_PARAMS(N, _)\
);\
}\
template<typename C, BOOST_PP_ENUM_PARAMS(N, typename T)>\
- typename boost::disable_if< is_option_listable<T0> >::type\
- csv_put( C& cont, BOOST_PP_ENUM_BINARY_PARAMS(N, T, const & _) )\
+ typename boost::disable_if<\
+ is_option_crtp<T0>\
+ >::type csv_put(\
+ C& cont,\
+ BOOST_PP_ENUM_BINARY_PARAMS(N, T, BOOST_PP_EXPR_IF(is_const, const)& _)\
+ )\
{\
- csv(\
- make_csv_suitable( put( cont ) ) \
- , BOOST_PP_ENUM_PARAMS(N, _)\
- );\
- }\
- template<typename C, typename Os, BOOST_PP_ENUM_PARAMS(N, typename T)>\
- typename boost::enable_if< is_option_listable<Os> >::type\
- csv_put( C& cont, Os const& options, BOOST_PP_ENUM_BINARY_PARAMS(N, T, const & _) )\
- {\
- csv(\
- make_csv_suitable( put( cont ) % options ) \
- , BOOST_PP_ENUM_PARAMS(N, _)\
- );\
+ csv( make_csv_ready( put( cont ) ), BOOST_PP_ENUM_PARAMS(N, _) );\
}\
/**/
BOOST_PP_REPEAT_FROM_TO(
1,
BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
- BOOST_ASSIGN_V2_MACRO3,
- ~
+ BOOST_ASSIGN_V2_MACRO,
+ 0
+)
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO,
+ 1
)
-#undef BOOST_ASSIGN_V2_MACRO1
-#undef BOOST_ASSIGN_V2_MACRO2
-#undef BOOST_ASSIGN_V2_MACRO3
+#undef BOOST_ASSIGN_V2_MACRO
#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
}// interpreter_aux
Modified: sandbox/assign_v2/boost/assign/v2/put/delayed_csv_put.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/delayed_csv_put.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/delayed_csv_put.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -14,7 +14,6 @@
#include <boost/assign/v2/detail/traits.hpp>
#include <boost/assign/v2/put/put.hpp>
#include <boost/assign/v2/option/list.hpp>
-#include <boost/assign/v2/option/data_generator.hpp>
#include <boost/assign/v2/ref/array/as_arg_list.hpp>
#include <boost/assign/v2/ref/array/csv_array.hpp>
#include <boost/assign/v2/ref/wrapper/copy.hpp>
@@ -24,6 +23,7 @@
#include <boost/mpl/vector/vector0.hpp>
#if !BOOST_ASSIGN_V2_ENABLE_CPP0X
#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
+#include <boost/assign/v2/ref/wrapper/cpp0x.hpp>
#include <boost/mpl/aux_/na.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/repetition.hpp>
@@ -38,137 +38,145 @@
typedef ref::array_aux::size_type arg_list_size_type;
- template<typename H, typename Tail, arg_list_size_type N, typename U>
- struct arg_list : list_option<H, Tail>/*<-*/
+ template<arg_list_size_type N, typename U, typename Os = empty_list_option>
+ struct delayed_csv_put_holder/*<-*/
{
- typedef list_option<H, Tail> list_option_;
typedef typename v2::ref::nth_result_of::csv_array<
N, U
- >::type arg_list_cont_type; //notice it's arg, not args
+ >::type arg_list_type; //notice it's arg, not args
- arg_list(){}
- arg_list(list_option_ const& l, arg_list_cont_type const& a)
- : list_option_( l ),
- arg_list_cont_( a )
+ delayed_csv_put_holder(){}
+ delayed_csv_put_holder(arg_list_type const& a)
+ : arg_list_( a )
{}
-
- arg_list_cont_type const& arg_list_cont() const
- {
- return this->arg_list_cont_;
- }
-
- protected:
- arg_list_cont_type arg_list_cont_;
-
- }/*->*/;
-
- template<
- typename Head/*<-*/ = typename empty_list_option::head_type/*->*/,
- typename Tail/*<-*/ = typename empty_list_option::tail_type/*->*/
- >
- class arg_list_generator : public list_option<Head, Tail>/*<-*/
- {
-
- typedef ::boost::mpl::na na_;
- typedef list_option<Head, Tail> list_option_;
-
- public:
-
- arg_list_generator(){}
- explicit arg_list_generator(Tail const& t, Head const& h)
- : list_option_( t, h )
+ delayed_csv_put_holder(Os options, arg_list_type const& a)
+ : options_( options ), arg_list_( a )
{}
- template<typename Option>
- struct modulo_result
+ arg_list_type const& arg_list() const
{
- typedef arg_list_generator<Option, arg_list_generator> type;
- };
-
- template<typename Option>
- typename modulo_result<Option>::type
- operator%(Option option)const
- {
- typedef typename modulo_result<Option>::type result_;
- return result_( *this, option );
+ return this->arg_list_cont_;
}
- template<arg_list_size_type N, typename U = na_>
- struct result{
- typedef interpreter_aux::arg_list<Head, Tail, N, U> type;
- };
-
- typename result<0>::type
- operator()()const
+ Os const& options() const
{
- typedef typename result<0>::type result_;
- return result_(
- *this,
- ref::csv_array<na_>( _nil )
- );
+ return this->options_;
}
-
-#if BOOST_ASSIGN_V2_ENABLE_CPP0X
protected:
- template<typename T, typename...Args>
- typename result<sizeof...(Args) + 1, T>::type
- impl(T& t, Args&...args)const
- {
- typedef typename result<sizeof...(Args)+1, T>::type result_;
- namespace ns = ref::assign_copy;
- return result_(*this, ref::csv_array( t, args... ) );
- }
+ Os options_;
+ arg_list_type arg_list_;
- public:
+ }/*->*/;
+
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
- template<typename T, typename...Args>
- typename boost::lazy_disable_if<
- v2::type_traits::or_const<T, Args...>,
- result<sizeof...(Args)+1, T>
- >::type
- operator()(T& t, Args&...args)const
- {
- return this->impl(t, args...);
- }
+namespace result_of{
- template<typename T, typename...Args>
- typename result<sizeof...(Args)+1, T const>::type
- operator()(T const& t, Args const&...args)const
- {
- return this->impl(t, args...);
- }
+ template<arg_list_size_type N, typename U, typename Os = empty_list_option>
+ struct delayed_csv_put
+ {
+ typedef delayed_csv_put_holder<
+ typename ref::wrapper_param<U>::type, N, Os
+ > type;
+ };
+
+}// result_of
+
+ // Explicit U
+
+ template<typename U, typename...Args>
+ typename result_of::delayed_csv_put<U, size_of...(Args)>::type
+ delayed_csv_put(Args&&... args)
+ {
+ return typename result_of::delayed_csv_put<U, size_of...(Args)>::type(
+ ref::csv_array<U>( std::forward<Args>( args )... )
+ );
+ }
+
+ template<typename U, typename O, bool is, typename...Args>
+ typename result_of::delayed_csv_put<U, size_of...(Args), O>::type
+ delayed_csv_put(option_crtp<O, is> const& crtp, Args&&... args)
+ {
+ typedef O const& options_;
+ options_ options = static_cast<options_>( crtp );
+ return typename result_of::delayed_csv_put<
+ U, size_of...(Args), O
+ >::type(
+ options,
+ ref::csv_array<U>( std::forward<Args>( args )... )
+ );
+ }
+
+ // Implicit U
+
+ template<typename U, typename...Args>
+ typename result_of::delayed_csv_put<U, 1 + size_of...(Args)>::type
+ delayed_csv_put(U&& u, Args&&... args)
+ {
+ return delayed_csv_put<U>(
+ std::forward<U>( u ),
+ std::forward<Args>( args ) ...
+ );
+ }
+ template<typename U, typename O, bool is, typename...Args>
+ typename result_of::delayed_csv_put<U, 1 + size_of...(Args), O>::type
+ delayed_csv_put(option_crtp<O, is> const& crtp, U&& u, Args&&... args)
+ {
+ return delayed_csv_put<U>(
+ crtp,
+ std::forward<U>( u ),
+ std::forward<Args>( args ) ...
+ );
+ }
+
#else
-#define BOOST_ASSIGN_V2_MACRO1(N, U)\
- return result_( \
- *this, \
- ref::csv_array<U>( BOOST_PP_ENUM_PARAMS(N, _) ) \
- );\
-/**/
-#define BOOST_ASSIGN_V2_MACRO2(z, N, data)\
- template<typename T>\
- typename result<N, T>::type\
- operator()( BOOST_PP_ENUM_PARAMS(N, T &_) )const \
- { \
- typedef typename result<N, T>::type result_;\
- BOOST_ASSIGN_V2_MACRO1( N, T )\
- } \
- template<typename T>\
- typename result<N, T const>::type\
- operator()( BOOST_PP_ENUM_PARAMS(N, T const &_) )const \
- { \
- typedef typename result<N, T const>::type result_;\
- BOOST_ASSIGN_V2_MACRO1( N, T const )\
- } \
+ template<typename U>
+ typename result_of::delayed_csv_put<U, 0>::type
+ delayed_csv_put()
+ {
+ return typename result_of::delayed_csv_put<U, 0>::type(
+ ref::csv_array<U>();
+ );
+ }
+
+#define BOOST_ASSIGN_V2_MACRO2(z, N, U)\
+ template<typename T, arg_list_size_type N>\
+ typename result_of::delayed_csv_put<U, N>::type\
+ delayed_csv_put( BOOST_PP_ENUM_PARAMS(N, U &_) )\
+ {\
+ return typename result_of::delayed_csv_put<U, N>::type(\
+ ref::csv_array<U>( BOOST_PP_ENUM_PARAMS(N, _) )\
+ );\
+ }\
+ template<typename T, typename O, bool is, arg_list_size_type N>\
+ typename result_of::delayed_csv_put<U, N>::type\
+ delayed_csv_put(\
+ option_crtp<O, is> const& crtp,\
+ BOOST_PP_ENUM_PARAMS(N, U &_)\
+ )\
+ {\
+ typedef O const& options_;\
+ options_ options = static_cast<options_>( crtp );\
+ return typename result_of::delayed_csv_put<U, N>::type(\
+ ref::csv_array<U>( BOOST_PP_ENUM_PARAMS(N, _) )\
+ );\
+ }\
/**/
BOOST_PP_REPEAT_FROM_TO(
1,
BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
BOOST_ASSIGN_V2_MACRO2,
- ~
+ T
+)
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO2,
+ T const
)
#undef BOOST_ASSIGN_V2_MACRO1
#undef BOOST_ASSIGN_V2_MACRO2
@@ -177,39 +185,18 @@
}/*->*/;
- template<
- typename C, typename H, typename T,
- arg_list_size_type N, typename U
- >
- C& operator|(C& cont, interpreter_aux::arg_list<H, T, N, U> const& arg_list)/*<-*/
+ template<typename C, arg_list_size_type N, typename U, typename Os>
+ C& operator|(C& cont, delayed_csv_put_holder<N, U, Os> const& rhs)/*<-*/
{
- typedef typename ::boost::mpl::if_c<
- !container_aux::is_map<C>::value,
- use_default_,
- value_
- >::type arg_;
-
- v2::ref::as_arg_list(
- arg_list.apply(
- put( cont ) % ( _data = arg_() )
- ),
- arg_list.arg_list_cont()
+ v2::ref::as_arg_list(
+ make_csv_ready( put( cont ) % rhs.options() ),
+ rhs.arg_list()
);
return cont;
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
}// interpreter_aux
-//<-
-namespace{
-//->
-
- interpreter_aux::arg_list_generator<> const _csv_put/*<-*/
- = interpreter_aux::arg_list_generator<>()/*->*/;
-
-//<-
-}
-//->
//]
}// v2
}// assign
Modified: sandbox/assign_v2/boost/assign/v2/put/put.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/put.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/put.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -22,20 +22,19 @@
//[syntax_put_put
namespace interpreter_aux{
- template<typename C, typename F, typename ModifierTag, typename DataTag>
+ template<typename C, typename F, typename MTag, typename DTag>
class put_interpreter :
//<-
- protected ref::wrapper< ref::assign_tag::copy, C >,
+ protected ref::copy_wrapper< C >::type,
//->
public interpreter_aux::interpreter_crtp<
- C,
- F,
- ModifierTag, DataTag, put_interpreter<C, F, ModifierTag, DataTag>
+ C, F, MTag, DTag,
+ put_interpreter<C, F, MTag, DTag>
>
{
//<-
typedef interpreter_aux::interpreter_crtp<
- C, F, ModifierTag, DataTag, put_interpreter
+ C, F, MTag, DTag, put_interpreter
> super2_t;
//->
public:
@@ -46,7 +45,7 @@
//<-
protected:
- typedef interpreter_aux::interpreter_modifier<ModifierTag> modifier_;
+ typedef interpreter_aux::interpreter_modifier<MTag> modifier_;
typedef ref::assign_tag::copy assign_tag_;
typedef ref::wrapper<assign_tag_,C> super1_t;
//->
@@ -67,38 +66,38 @@
};
- template<typename C, typename F, typename ModifierTag, typename DataTag>
+ template<typename C, typename F, typename MTag, typename DTag>
struct replace_data_generator<
- interpreter_aux::put_interpreter<C, F, ModifierTag, DataTag>
+ interpreter_aux::put_interpreter<C, F, MTag, DTag>
>{
template<typename F1>
struct apply/*<-*/{
typedef interpreter_aux::put_interpreter<
- C, F1, ModifierTag, DataTag
+ C, F1, MTag, DTag
> type;
}/*->*/;
};
- template<typename C, typename F, typename ModifierTag, typename DataTag>
+ template<typename C, typename F, typename MTag, typename DTag>
struct replace_modifier_tag<
- interpreter_aux::put_interpreter<C, F, ModifierTag, DataTag>
+ interpreter_aux::put_interpreter<C, F, MTag, DTag>
>{
- template<typename ModifierTag1>
+ template<typename MTag1>
struct apply/*<-*/{
typedef interpreter_aux::put_interpreter<
- C, F, ModifierTag1, DataTag
+ C, F, MTag1, DTag
> type;
}/*->*/;
};
- template<typename C, typename F, typename ModifierTag, typename DataTag>
+ template<typename C, typename F, typename MTag, typename DTag>
struct replace_data_tag<
- interpreter_aux::put_interpreter<C, F, ModifierTag, DataTag>
+ interpreter_aux::put_interpreter<C, F, MTag, DTag>
>{
- template<typename DataTag1>
+ template<typename DTag1>
struct apply/*<-*/{
typedef interpreter_aux::put_interpreter<
- C, F, ModifierTag, DataTag1
+ C, F, MTag, DTag1
> type;
}/*->*/;
};
@@ -108,14 +107,14 @@
template<
typename C/*<-*/
- , typename DataGenerator
+ , typename DGen
= typename interpreter_aux::deduce_data_generator<C>::type
>
struct put/*<-*/{
typedef
interpreter_aux::put_interpreter<
C
- , DataGenerator
+ , DGen
, typename interpreter_aux::deduce_modifier_tag<C>::type
, typename interpreter_aux::deduce_data_tag<C>::type
>
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-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -11,7 +11,6 @@
#define BOOST_ASSIGN_V2_REF_ARRAY_CSV_ARRAY_ER_2010_HPP
#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
#include <boost/assign/v2/detail/pp/ignore.hpp>
-#include <boost/assign/v2/detail/keyword.hpp>
#include <boost/assign/v2/ref/array/alloc/instant.hpp>
#include <boost/assign/v2/ref/array/size_type.hpp>
@@ -29,9 +28,7 @@
namespace v2{
//[syntax_ref_array_csv_array
namespace ref{
-//<-
namespace array_aux{
-//->
namespace nth_result_of{
template<
@@ -45,28 +42,29 @@
}// result_of
+
template<typename U>
typename nth_result_of::csv_array<0, U>::type
- csv_array( nil_ )/*<-*/
+ csv_array()/*<-*/
{
typedef typename nth_result_of::csv_array<0, U>::type result_;
return result_();
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
-//<-
}// array_aux
using array_aux::csv_array;
namespace nth_result_of{
template<array_size_type N, typename U>
- struct csv_array
+ struct csv_array/*<-*/
: array_aux::nth_result_of::csv_array<N, U>
- {};
+ {}/*->*/;
}// nth_result_of
+/*<-*/
#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+/*->*/
namespace array_aux{
-//->
namespace result_of{
template<typename U, typename... Args>
@@ -121,11 +119,7 @@
return csv_helper<T const, Args const ...>::call( t, args... );
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
-//<-
}// array_aux
-
-using array_aux::csv_array;
-
namespace result_of{
template<typename U, typename... Args>
@@ -135,7 +129,8 @@
{}/*->*/;
}// result_of
-#endif
+//<-
+#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
//->
}// ref
//]
Modified: sandbox/assign_v2/boost/assign/v2/ref/aux_/list.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/aux_/list.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/ref/aux_/list.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -10,7 +10,6 @@
#ifndef BOOST_ASSIGN_V2_REF_AUX_LIST_ER_2010_HPP
#define BOOST_ASSIGN_V2_REF_AUX_LIST_ER_2010_HPP
#include <boost/assign/v2/ref/aux_/list/array.hpp>
-#include <boost/assign/v2/ref/aux_/list/as_modulo_list.hpp>
#include <boost/assign/v2/ref/aux_/list/at.hpp>
#include <boost/assign/v2/ref/aux_/list/container.hpp>
#include <boost/assign/v2/ref/aux_/list/fwd.hpp>
Modified: sandbox/assign_v2/boost/assign/v2/ref/aux_/list/array/policy.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/aux_/list/array/policy.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/ref/aux_/list/array/policy.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -65,7 +65,7 @@
};
template<typename U1>
- struct policy_helper2<U1, void_, nil >
+ struct policy_helper2<U1, void_, nil_ >
{
// Reached root
typedef U1 type;
@@ -79,7 +79,7 @@
>{};
template<>
- struct policy_helper3<void_, nil >
+ struct policy_helper3<void_, nil_ >
{
// Empty container
typedef void_ type;
@@ -89,7 +89,7 @@
struct policy<array_tag>
{
- template<typename H = void_, typename T = nil>
+ template<typename H = void_, typename T = nil_>
struct apply
{
typedef alloc_tag::lazy_alloc tag_;
Modified: sandbox/assign_v2/boost/assign/v2/ref/aux_/list/as_modulo_list.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/aux_/list/as_modulo_list.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/ref/aux_/list/as_modulo_list.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -1,99 +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_LIST_REF_AS_MODULO_LIST_ER_2010_HPP
-#define BOOST_ASSIGN_V2_LIST_REF_AS_MODULO_LIST_ER_2010_HPP
-#include <boost/assign/v2/ref/aux_/list/at.hpp>
-#include <boost/assign/v2/ref/aux_/list/fwd.hpp>
-#include <boost/config.hpp>
-#include <boost/mpl/at.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/typeof/typeof.hpp>
-
-namespace boost{
-namespace assign{
-namespace v2{
-namespace ref{
-namespace list_aux{
-
- template<size_type N, typename Lhs, typename ParList,
- bool exit = (N == ::boost::mpl::size<ParList>::value)>
- struct as_modulo_list_impl
- {
- typedef typename ::boost::mpl::at_c<ParList, N>::type at_;
-
- template<typename P>
- struct result
- {
- static Lhs lhs;
- static P p;
-
-#ifdef BOOST_MSVC
- BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested, lhs % p )
- typedef typename nested::type type;
-#else
- typedef BOOST_TYPEOF_TPL( lhs % p ) type;
-#endif
- };
-
- typedef typename result<at_>::type result_;
-
- typedef as_modulo_list_impl<N + 1, result_, ParList> next_;
-
- typedef typename next_::type type;
-
- template<typename RhsList>
- static type call(Lhs const& lhs, RhsList const& rhs_list)
- {
- return next_::call( lhs % ref::at<N>( rhs_list ) , rhs_list );
- }
-
- };
-
- template<size_type N, typename Lhs, typename ParList>
- struct as_modulo_list_impl<N, Lhs, ParList, true>
- {
-
- typedef Lhs type;
-
- template<typename RhsList>
- static type call(Lhs const& lhs, RhsList const& rhs_list)
- {
- return lhs;
- }
-
- };
-
-namespace result_of{
-
- // ParList could, in principle, be specified in terms (Tag, H, T), but we
- // chose not to (that would be less practical in client code).
- template<typename Lhs, typename ParList>
- struct as_modulo_list : as_modulo_list_impl<0, Lhs, ParList>{};
-
-}// result_of
-
- // Warning Parlist is first argument, here, whereas second in result_of::
- template<typename ParList, typename Lhs, typename Tag, typename H, typename T>
- typename result_of::as_modulo_list<Lhs, ParList>::type
- as_modulo_list( Lhs const& lhs, container<Tag, H, T> const& rhs_list )
- {
- typedef result_of::as_modulo_list<Lhs, ParList> caller_;
- return caller_::call( lhs, rhs_list );
- }
-
-}// list_aux
-using namespace list_aux::result_of;
-using list_aux::as_modulo_list;
-}// ref
-}// v2
-}// assign
-}// boost
-
-#endif // BOOST_ASSIGN_V2_LIST_REF_AS_MODULO_LIST_ER_2010_HPP
+// TODO remove file
\ No newline at end of file
Modified: sandbox/assign_v2/boost/assign/v2/ref/aux_/list/container.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/aux_/list/container.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/ref/aux_/list/container.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -13,6 +13,7 @@
#include <boost/assign/v2/ref/aux_/list/holder/tail.hpp>
#include <boost/assign/v2/ref/aux_/list/holder/head.hpp>
#include <boost/assign/v2/ref/aux_/list/policy.hpp>
+#include <boost/mpl/bool.hpp>
#include <boost/call_traits.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/type_traits/is_same.hpp>
@@ -33,8 +34,13 @@
typedef tail_holder<T> tail_holder_;
typedef head_holder<H> head_holder_;
+ typedef boost::mpl::false_ false_;
+ typedef boost::mpl::true_ true_;
+
public:
+ typedef boost::is_same<T, nil_> is_empty;
+
container(){}
template<typename H1>
@@ -43,26 +49,37 @@
typedef container<Tag, H1, this_> type;
};
- explicit container(
- typename boost::call_traits<T>::param_type t,
- H h
- ):
- tail_holder_( t )
- , head_holder_( h )
+ explicit container(typename ptr_wrapper<T>::type t, H h)
+ : tail_holder_( t ),
+ head_holder_( h )
{}
template<typename H1>
typename result<H1&>::type
- operator()(H1& h)const{
- typedef typename result<H1&>::type result_;
- return result_( *this, h );
+ operator()(H1& h)const{
+ return this->impl( h );
}
template<typename H1>
typename result<H1 const&>::type
- operator()(H1 const& h)const{
- typedef typename result<H1 const&>::type result_;
- return result_( *this, h );
+ operator()(H1 const& h)const{
+ return this->impl( h );
+ }
+
+ protected:
+
+ typename ptr_wrapper<container>::type clone()const
+ {
+ return typename ptr_wrapper<container>::type(
+ new container( *this )
+ );
+ }
+
+ template<typename H1>
+ typename result<H1&>::type
+ impl(H1 & h)const{
+ typedef typename result<H1&>::type result_;
+ return result_( this->clone(), h );
}
};
Modified: sandbox/assign_v2/boost/assign/v2/ref/aux_/list/fwd.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/aux_/list/fwd.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/ref/aux_/list/fwd.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -9,6 +9,7 @@
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_ASSIGN_V2_REF_AUX_LIST_FWD_ER_2010_HPP
#define BOOST_ASSIGN_V2_REF_AUX_LIST_FWD_ER_2010_HPP
+#include <boost/assign/v2/detail/keyword.hpp>
namespace boost{
namespace assign{
@@ -21,9 +22,8 @@
template<typename Tag> struct empty_list;
struct void_;
- struct nil;
- template<typename Tag, typename H = void_, typename T = nil>
+ template<typename Tag, typename H = void_, typename T = nil_>
class container;
}// list_aux
Modified: sandbox/assign_v2/boost/assign/v2/ref/aux_/list/holder/tail.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/aux_/list/holder/tail.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/ref/aux_/list/holder/tail.hpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -9,9 +9,11 @@
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_ASSIGN_V2_REF_AUX_LIST_HOLDER_TAIL_ER_2010_HPP
#define BOOST_ASSIGN_V2_REF_AUX_LIST_HOLDER_TAIL_ER_2010_HPP
+#include <boost/assign/v2/detail/keyword.hpp>
+#include <boost/assign/v2/ref/aux_/list/fwd.hpp>
#include <boost/config.hpp>
#include <boost/mpl/int.hpp>
-#include <boost/assign/v2/ref/aux_/list/fwd.hpp>
+#include <boost/shared_ptr.hpp>
namespace boost{
namespace assign{
@@ -19,28 +21,33 @@
namespace ref{
namespace list_aux{
- struct nil{ nil(){} };
+ template<typename T>
+ struct ptr_wrapper
+ {
+ typedef boost::shared_ptr<T const> type;
+ };
template<typename T>
struct tail_holder
{
-
-
typedef T tail_type;
- typedef ::boost::mpl::int_<T::static_size::value + 1> static_size;
+ typedef ::boost::mpl::int_<
+ T::static_size::value + 1
+ > static_size;
typedef T const& result_of_tail_type;
+ typedef typename ptr_wrapper<T>::type ptr_wrapper_;
- tail_holder(T const& t) : tail_( t ){}
- result_of_tail_type tail()const{ return this->tail_; }
+ tail_holder(ptr_wrapper_ w) : tail_( w ){}
+ result_of_tail_type tail()const{ return *this->tail_; }
private:
- T const tail_; // A reference would cause ref to temporary
+ typename ptr_wrapper<T>::type const tail_;
};
template<>
- struct tail_holder<nil>
+ struct tail_holder<nil_>
{
- typedef nil tail_type;
+ typedef nil_ tail_type;
typedef ::boost::mpl::int_<0> static_size;
tail_holder(){}
Modified: sandbox/assign_v2/libs/assign/v2/src/main.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/src/main.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/src/main.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -61,18 +61,18 @@
}
{
using namespace test_assign_v2;
- xxx_chain::test();
- xxx_conversion::test();
- xxx_detail::test();
+ //xxx_chain::test();
+ //xxx_conversion::test();
+ //xxx_detail::test();
xxx_deque::test();
- xxx_interpreter::test();
+ //xxx_interpreter::test();
xxx_option::test();
- xxx_pipe::test();
+ //xxx_pipe::test();
xxx_put::test();
xxx_ref::test();
}
{
- tutorial_assign_v2::run();
+ //tutorial_assign_v2::run();
}
{/*
using namespace speed_assign_v2;
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-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -41,15 +41,19 @@
{
//[test_conversion_vec_array
std::vector<int> r( 3 ); r[0] = 1 ; r[1] = 10; r[2] = 100;
+
typedef array<int, 3> ar_;
ar_ const& ar = ( r | as2::convert<ar_>() );
- BOOST_ASSIGN_V2_CHECK( range::equal( ar, as2::csv_deque( 1 , 10, 100 ) ) );
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal( ar, as2::csv_deque( 1 , 10, 100 ) )
+ );
//]
}
{
//[test_conversion_vec_stack
std::vector<int> r( 3 ); r[0] = 1 ; r[1] = 10; r[2] = 100;
+
std::stack<int> lifo = as2::converter( r );
BOOST_ASSIGN_V2_CHECK( lifo.top() == 100 );
@@ -57,7 +61,8 @@
}
{
//[test_conversion_stl
- typedef int T; typedef std::vector<T> R; R r( 3 ); r[0] = 1 ; r[1] = 10; r[2] = 100;
+ typedef int T; typedef std::vector<T> R;
+ R r( 3 ); r[0] = 1 ; r[1] = 10; r[2] = 100;
f< std::vector<T> >( as2::converter( r ), r );
f< std::deque<T> >( as2::converter( r ), r );
f< std::list<T> >( as2::converter( r ), r );
@@ -95,7 +100,7 @@
}
{
//[test_conversion_ref_array_stack
- std::stack<int> lifo = /*<<Notice unqualified (name lookup)>>*/converter( as2::ref::array( 1 )( 10 )( 100 ) );
+ std::stack<int> lifo = /*<<Notice unqualified (name lookup)>>*/converter( as2::ref::array( 1 )( 10 )( 100 ) );
BOOST_ASSIGN_V2_CHECK( lifo.top() == 100 );
//]
Modified: sandbox/assign_v2/libs/assign/v2/test/deque.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/deque.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/deque.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -27,23 +27,6 @@
using namespace boost;
namespace as2 = assign::v2;
{
- //[test_deque_ints
- typedef as2::result_of::deque<int>::type C;
-
- C empty_cont = as2::deque<int>( as2::_nil );
- C cont1 = empty_cont( 1 )( 10 )( 100 );
- C cont2 = as2::deque<int>( 1 )( 10 )( 100 );
-
- std::deque<int> benchmark;
- benchmark.push_back( 1 );
- benchmark.push_back( 10 );
- benchmark.push_back( 100 );
-
- BOOST_ASSIGN_V2_CHECK( range::equal( benchmark, cont1 ) );
- BOOST_ASSIGN_V2_CHECK( range::equal( benchmark, cont2 ) );
- //]
- }
- {
//[test_deque_str_literal
typedef as2::result_of::deque<char*>::type C;
@@ -59,39 +42,30 @@
}
{
//[test_deque_pair
- typedef std::string str_;
- typedef std::pair<str_, str_> T;
+ typedef std::string code_; typedef std::string name_;
+ typedef std::pair<code_, name_> T;
typedef as2::result_of::deque<T>::type C;
- C airports = as2::deque<T>("AUH", "Abu Dhabi")("JFK", "New York")("LHR", "London")("PEK", "Beijing");
+
+ C airports1 = as2::deque<T>( as2::_nil );
+ BOOST_ASSIGN_V2_CHECK( airports1.empty() );
+ airports1("AUH", "Abu Dhabi")("JFK", "New York")("LHR", "London")("PEK", "Beijing");
std::deque<T> benchmark;
benchmark.push_back( T("AUH", "Abu Dhabi") );
benchmark.push_back( T("JFK", "New York") );
- benchmark.push_back( T("LHR", "Heathrow") );
+ benchmark.push_back( T("LHR", "London") );
benchmark.push_back( T("PEK", "Beijing") );
-
- range::equal( benchmark, airports );
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal( benchmark, airports1 )
+ );
+
+ C airports2 = as2::deque<T>("AUH", "Abu Dhabi")("JFK", "New York")("LHR", "London")("PEK", "Beijing");
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal( benchmark, airports2 )
+ );
//]
}
- {
- //[test_csv_deque_ints
- typedef as2::result_of::csv_deque<int>::type C;
-
- BOOST_MPL_ASSERT(( is_same<C, as2::result_of::deque<int>::type> ));
-
- C cont1 = as2::csv_deque( 1, 10, 100 );
- C cont2 = as2::csv_deque( 1, 10 )( 100 );
-
- std::deque<int> benchmark;
- benchmark.push_back( 1 );
- benchmark.push_back( 10 );
- benchmark.push_back( 100 );
-
- BOOST_ASSIGN_V2_CHECK( range::equal( benchmark, cont1 ) );
- BOOST_ASSIGN_V2_CHECK( range::equal( benchmark, cont2 ) );
- //]
- }
- {
+ {
//[test_csv_deque_str_literal
typedef as2::result_of::csv_deque<const char[2]>::type C;
@@ -107,6 +81,31 @@
BOOST_ASSIGN_V2_CHECK( range::equal( benchmark, deque ) );
//]
}
+
+ {
+ //[test_csv_deque_ints
+ typedef as2::result_of::csv_deque<int>::type C;
+
+ BOOST_MPL_ASSERT(( is_same<C, as2::result_of::deque<int>::type> ));
+
+ C series1 = as2::csv_deque( 0, 1, 1, 2, 3, 5, 8 );
+
+ std::deque<int> benchmark;
+ benchmark.push_back( 0 );
+ benchmark.push_back( 1 );
+ benchmark.push_back( 1 );
+ benchmark.push_back( 2 );
+ benchmark.push_back( 3 );
+ benchmark.push_back( 5 );
+ benchmark.push_back( 8 );
+
+ BOOST_ASSIGN_V2_CHECK( range::equal( benchmark, series1 ) );
+
+ C series2 = as2::csv_deque( 0, 1, 1 )( 2 )( 3 )( 5 )( 8 );
+
+ BOOST_ASSIGN_V2_CHECK( range::equal( benchmark, series2 ) );
+ //]
+ }
}
}// xxx_deque
Modified: sandbox/assign_v2/libs/assign/v2/test/interpreter/modifier.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/interpreter/modifier.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/interpreter/modifier.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -30,9 +30,9 @@
namespace xxx_interpreter{
namespace xxx_modifier{
- // --User may skip this file-- //
- // It checks internal details. //
- // --------------------------- //
+ // ------------------------ //
+ // Checks internal details. //
+ // ------------------------ //
void test()
{
Modified: sandbox/assign_v2/libs/assign/v2/test/option.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/option.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/option.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -25,7 +25,7 @@
xxx_mapped::test();
xxx_list::test();
xxx_repeat::test();
- // xxx_row_major::test(); // TODO
+ xxx_row_major::test();
xxx_standard::test();
}
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-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -53,17 +53,22 @@
}
{
//[test_option_data_recursive
- using namespace lambda;
int i = 1, k = 1;
+
BOOST_AUTO(
factorials, (
as2::deque<int>( as2::_nil ) % (
- as2::_data = ( var(k) *= ( var(i)++ ) )
+ as2::_data = ( lambda::var( k ) *= ( lambda::var( i )++ ) )
)
- )/*<<Equivalent to `factorials( k *= i++ )` for [^i = 1, ..., 5]>>*/()()()()()
+ )()()()()()
);
- BOOST_ASSIGN_V2_CHECK( range::equal( factorials, as2::csv_deque( 1, 2, 6, 24, 120 ) ) );
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal(
+ factorials,
+ as2::csv_deque( 1, 2, 6, 24, 120 )
+ )
+ );
//]
}
{
Modified: sandbox/assign_v2/libs/assign/v2/test/option/iterate.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/option/iterate.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/option/iterate.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -7,16 +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 <vector>
+#include <list>
#include <boost/array.hpp>
#include <boost/assign/v2/detail/config/check.hpp>
#include <boost/assign/v2/deque.hpp>
#include <boost/assign/v2/option/modifier/iterate.hpp>
#include <boost/assign/v2/put/csv_put.hpp>
-#include <boost/assign/v2/put/put.hpp>
#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
-#include <boost/lambda/construct.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/range/algorithm/equal.hpp>
@@ -47,7 +44,6 @@
}
{
//[test_option_iterate_shifted
- using namespace lambda;
typedef int T; array<T, 10> alternating;
alternating[0] = -1; alternating[1] = +1;
alternating[2] = -2;
@@ -55,7 +51,7 @@
int index = 3;
as2::csv_put(
alternating
- , as2::_iterate = var( index )++
+ , as2::_iterate = lambda::var( index )++
, +2, -3, +3, -4, +4, -5, +5
);
@@ -67,7 +63,6 @@
);
//]
}
-/*
{
//[test_option_iterate_meta_deque
typedef as2:: interpreter_aux::keyword_iterate keyword_;
@@ -82,17 +77,14 @@
}
{
//[test_option_iterate_shifted_deque
- using namespace lambda;
-
- as2::result_of::deque<int>::type incomplete
- = as2::deque<int>( -1 )( +1 )( -2 )
- ( as2::as_arg_list( std::vector<int>( 7 ) ) );
+ as2::result_of::csv_deque<int>::type tmp = as2::csv_deque<int>
+ ( -1, +1, -2, as2::as_arg_list( std::list<int>( 7 ) ) );
+
int index = 3;
-
BOOST_AUTO(
alternating ,
(
- incomplete % ( as2::_iterate = var( index )++ )
+ tmp % ( as2::_iterate = lambda::var( index )++ )
)( +2 )( -3 )( +3 )( -4 )( +4 )( -5 )( +5 )
);
@@ -104,7 +96,6 @@
);
//]
}
-*/
}
}// xxx_iterate
Modified: sandbox/assign_v2/libs/assign/v2/test/option/list.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/option/list.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/option/list.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -9,12 +9,13 @@
//////////////////////////////////////////////////////////////////////////////
#include <deque>
#include <boost/assign/v2/detail/config/check.hpp>
-#include <boost/assign/v2/put/put.hpp>
+#include <boost/assign/v2/deque/csv_deque.hpp>
#include <boost/assign/v2/option/list.hpp>
#include <boost/assign/v2/option/data_generator.hpp>
#include <boost/assign/v2/option/modifier/std.hpp>
+#include <boost/assign/v2/put/put.hpp>
#include <boost/lambda/lambda.hpp>
-#include <boost/static_assert.hpp>
+#include <boost/range/algorithm/equal.hpp>
#include <boost/typeof/typeof.hpp>
#include <libs/assign/v2/test/option/list.h>
@@ -24,23 +25,31 @@
void test()
{
- using namespace boost::assign::v2;
- std::deque<int> cont;
+ using namespace boost;
+ namespace as2 = assign::v2;
+
+ {
+ //[test_option_list
+ std::deque<int> cont;
+ ( as2::put( cont ) % as2::_list_option )( 4 )( 5 );
+
+ BOOST_ASSIGN_V2_CHECK( cont[0] == 4 );
+ BOOST_ASSIGN_V2_CHECK( cont[1] == 5 );
- ( _list_option ).apply( put( cont ) )( 1 );
- BOOST_ASSIGN_V2_CHECK( cont[0] == 1 );
- using namespace boost::lambda;
- BOOST_AUTO(
- apply,
- (
- _push_front % ( _data = ( _1 % 10 ) )
- ).apply( put( cont ) )
- );
- apply( 15 );
- BOOST_ASSIGN_V2_CHECK( cont[0] == 5 );
- BOOST_ASSIGN_V2_CHECK( cont[1] == 1 );
- }
+ BOOST_AUTO(
+ options,
+ as2::_push_front % ( as2::_data = ( lambda::_1 % 10 ) )
+ );
+ ( as2::put( cont ) % options )( 13 )( 12 )( 11 );
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal( cont, as2::csv_deque( 1, 2, 3, 4, 5 ) )
+ );
+ //]
+ }
+
+ }
+
}// xxx_list
}// xxx_option
}// xxx_test_assign
Modified: sandbox/assign_v2/libs/assign/v2/test/option/mapped.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/option/mapped.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/option/mapped.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -10,10 +10,10 @@
#include <map>
#include <string>
#include <cmath>
+#include <list>
#include <boost/assign/v2/detail/config/check.hpp>
#include <boost/assign/v2/put/put.hpp>
#include <boost/assign/v2/deque.hpp>
-// Options come next
#include <boost/assign/v2/option/data_generator.hpp>
#include <boost/assign/v2/option/modifier/mapped.hpp>
#include <boost/lambda/lambda.hpp>
@@ -35,23 +35,21 @@
namespace as2 = assign::v2;
{
//[test_option_mapped_map
- using namespace lambda;
typedef std::string month_; typedef int days_;
typedef std::map<month_, days_> C; C year;
(
- as2::put( year )( "feb", 28 )( "apr", 30 )( "jun", 30 )( "sep", 30 )( "nov", 30 )
- % (as2::_data = as2::_key)
- % ( as2::_mapped = ( _1 = 31 ) )
+ as2::put( year )
+ ( "feb", 28 )( "apr", 30 )( "jun", 30 )( "sep", 30 )( "nov", 30 )
+ % ( as2::_data = as2::_key ) % ( as2::_mapped = ( lambda::_1 = 31 ) )
)/*<<Calls `year[ month_( "jan" ) ] = 31`>>*/( "jan" )( "mar" )( "may" )( "jul" )( "aug" )( "oct" )( "dec" );
-
+
BOOST_ASSIGN_V2_CHECK( year["jan"] == 31 );
BOOST_ASSIGN_V2_CHECK( year["dec"] == 31 );
//]
}
{
//[test_option_mapped_meta_deque
- using namespace lambda;
- typedef BOOST_TYPEOF(_1) arg_;
+ typedef BOOST_TYPEOF(lambda::_1) arg_;
typedef as2:: interpreter_aux::keyword_mapped keyword_;
typedef as2::result_of::deque<int>::type put_;
typedef as2::result_of::option_mapped<put_, arg_>::type result1_;
@@ -62,17 +60,21 @@
//]
}
{
- //[test_option_mapped_map_deque
- using namespace lambda;
+ //[test_option_mapped_deque
BOOST_AUTO(
- days_in_first_quater,
+ alternating,
(
- as2::deque<int>( 31 )( 31 )( 31 ) % ( as2::_mapped = ( _1 -= 3 ) )
- )( 1 )
+ as2::deque<int>(
+ as2::as_arg_list( std::list<int>( 10, 1 ) )
+ ) % ( as2::_mapped = ( lambda::_1 *= -1 ) )
+ )( 1 )( 3 )( 5 )( 7 )( 9 )
+ );
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal(
+ alternating,
+ as2::csv_deque( +1, -1, +1, -1, +1, -1, +1, -1, +1, -1 )
+ )
);
- BOOST_ASSIGN_V2_CHECK( days_in_first_quater[0] == 31 );
- BOOST_ASSIGN_V2_CHECK( days_in_first_quater[1] == 28 );
- BOOST_ASSIGN_V2_CHECK( days_in_first_quater[2] == 31 );
//]
}
}
Modified: sandbox/assign_v2/libs/assign/v2/test/option/std_modifier.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/option/std_modifier.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/option/std_modifier.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -83,7 +83,8 @@
{
//[test_option_insert
// NB: This option is dedundant with the default
- std::set<std::string> letters; as2::csv_put( letters, as2::_insert, "d", "a", "c", "b" );
+ std::set<std::string> letters;
+ as2::csv_put( letters, as2::_insert, "d", "a", "c", "b" );
BOOST_ASSIGN_V2_CHECK( letters.lower_bound( "a" ) == boost::begin( letters ) );
BOOST_ASSIGN_V2_CHECK( letters.upper_bound( "d" ) == boost::end( letters ) );
@@ -116,10 +117,12 @@
//[test_option_push_front_deque
BOOST_AUTO(
two_power_n,
- ( as2::deque<int>( as2::_nil ) % as2::_push_front )( 16 )( 8 )( 4 )( 2 )( 1 )
+ as2::csv_deque( as2::_push_front, 16, 8, 4, 2, 1 )
);
- BOOST_ASSIGN_V2_CHECK( range::equal( two_power_n, as2::csv_deque( 1, 2, 4, 8, 16 ) ) );
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal( two_power_n, as2::csv_deque( 1, 2, 4, 8, 16 ) )
+ );
//]
}
}
Modified: sandbox/assign_v2/libs/assign/v2/test/pipe/option/data.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/pipe/option/data.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/pipe/option/data.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -31,12 +31,12 @@
{
//[test_pipe_option_data_math
int k = 1; std::list<int> factorials;
- using namespace lambda;
BOOST_ASSIGN_V2_CHECK(
range::equal(
factorials | (
- as2::_csv_put % ( as2::_data = ( var(k) *= _1 ) )
+ as2::_csv_put
+ % ( as2::_data = ( lambda::var(k) *= lambda::_1 ) )
)/*<<Equivalent to calling `factorials.push_back( k *= ++i )`>>*/( 1, 2, 3, 4, 5 ),
as2::csv_deque<int>( 1, 2, 6, 24, 120 )
)
Modified: sandbox/assign_v2/libs/assign/v2/test/pipe/option/iterate.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/pipe/option/iterate.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/pipe/option/iterate.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -36,11 +36,10 @@
alternating[2] = -2;
int i = 3;
- using namespace lambda;
BOOST_ASSIGN_V2_CHECK(
boost::range::equal(
alternating | (
- as2::_csv_put % ( as2::_iterate = var( i )++ )
+ as2::_csv_put % ( as2::_iterate = lambda::var( i )++ )
)( +2, -3, +3, -4, +4, -5, +5 ),
as2::csv_deque<T>( -1, +1, -2, +2, -3, +3, -4, +4, -5, +5 )
)
Modified: sandbox/assign_v2/libs/assign/v2/test/pipe/option/mapped.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/pipe/option/mapped.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/pipe/option/mapped.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -48,12 +48,11 @@
BOOST_AUTO( apply, as2::_csv_put % (as2::_data = as2::_key) );
C cal; as2::put( cal )("feb", 28);
- using namespace lambda;
BOOST_ASSIGN_V2_CHECK(
range::equal(
cal
- | ( apply % ( as2::_mapped = (_1 = 30) ) )( "apr", "jun", "sep", "nov" )
- | ( apply % ( as2::_mapped = (_1 = 31) ) )( "jan", "mar", "may", "jul", "aug", "oct", "dec" ),
+ | ( apply % ( as2::_mapped = (lambda::_1 = 30) ) )( "apr", "jun", "sep", "nov" )
+ | ( apply % ( as2::_mapped = (lambda::_1 = 31) ) )( "jan", "mar", "may", "jul", "aug", "oct", "dec" ),
benchmark
)
);
@@ -78,12 +77,11 @@
C cal; as2::put( cal )("feb", 28);
BOOST_AUTO( apply, as2::_csv_put % (as2::_data = as2::_key) );
- using namespace lambda;
BOOST_ASSIGN_V2_CHECK(
range::equal(
cal
- | ( apply % ( as2::_mapped = (_1 = 30) ) )( "apr", "jun", "sep", "nov" )
- | ( apply % ( as2::_mapped = (_1 = 31) ) )( "jan", "mar", "may", "jul", "aug", "oct", "dec" ),
+ | ( apply % ( as2::_mapped = ( lambda::_1 = 30) ) )( "apr", "jun", "sep", "nov" )
+ | ( apply % ( as2::_mapped = ( lambda::_1 = 31) ) )( "jan", "mar", "may", "jul", "aug", "oct", "dec" ),
benchmark
)
);
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-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -182,18 +182,18 @@
// OTHER
{
//test_csv_put_cb
- boost::circular_buffer<int> cb(3);
- as2::csv_put( cb, 1, 2, 3 );
+ 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::csv_deque(1, 2, 3) )
+ );
- as2::csv_put( cb, 4, 5 );
+ as2::csv_put( cb, 4, 5 );
- BOOST_ASSIGN_V2_CHECK(
- range::equal(cb, as2::csv_deque(3, 4, 5) )
- );
+ BOOST_ASSIGN_V2_CHECK(
+ range::equal(cb, as2::csv_deque(3, 4, 5) )
+ );
//]
}
}// test()
Modified: sandbox/assign_v2/libs/assign/v2/test/ref.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/ref.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/ref.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -18,13 +18,11 @@
namespace xxx_ref{
void test(){
-
xxx_array::test();
xxx_csv_array::test();
xxx_aux_::test();
xxx_get::test();
xxx_wrapper::test();
-
}
}// xxx_ref
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-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -29,6 +29,7 @@
using namespace boost;
namespace as2 = assign::v2;
{
+
//[test_ref_array_temporaries
boost::array<int, 3> ar;
ar[0] = 1; ar[1] = 10; ar[2] = 100;
@@ -44,7 +45,7 @@
{
//[test_ref_array_read
typedef int const T;
- T w = 11, x = 72, y = 31, z = 48;
+ T w = 1, x = 10, y = 100, z = 1000;
as2::ref::nth_result_of::array<3, T>::type ar3
= as2::ref::array( w )( x )( y );
{
Modified: sandbox/assign_v2/libs/assign/v2/test/ref/aux_/list.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/ref/aux_/list.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/ref/aux_/list.cpp 2011-04-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -24,9 +24,9 @@
namespace xxx_aux_{
namespace xxx_list{
- // --User may skip this file-- //
- // It checks internal details. //
- // --------------------------- //
+ // ------------------------ //
+ // Checks internal details. //
+ // -------------------------//
void test()
{
@@ -44,7 +44,7 @@
typedef add_reference<t1_>::type r1_;
typedef add_reference<t2_>::type r2_;
- t0_ a = 0;
+ t0_ a = 100;
t2_ c = "c";
typedef as2::ref::nth_result_of::list<tag_> result_;
@@ -54,10 +54,9 @@
// Reminder : temporaries destroyed at the semi-colon
// Implication : don't try to save the result.
-#define BOOST_ASSIGN_V2_macro as2::ref::list<tag_>( as2::_nil )( a )( 2 )( c )
-
+#define BOOST_ASSIGN_V2_macro as2::ref::list<tag_>( as2::_nil )( a )( -1 )( c )
BOOST_ASSIGN_V2_CHECK( &as2::ref::at<0>( BOOST_ASSIGN_V2_macro ) == &a );
- BOOST_ASSIGN_V2_CHECK( as2::ref::at<1>( BOOST_ASSIGN_V2_macro ) == 2 );
+ BOOST_ASSIGN_V2_CHECK( as2::ref::at<1>( BOOST_ASSIGN_V2_macro ) == -1 );
BOOST_ASSIGN_V2_CHECK( str_( as2::ref::at<2>( BOOST_ASSIGN_V2_macro ) ) == c );
#undef BOOST_ASSIGN_V2_macro
}
@@ -82,7 +81,7 @@
{
typedef as2::ref::alloc_tag::lazy_alloc tag_;
typedef as2::ref::list_aux::void_ void_;
- typedef as2::ref::list_aux::nil nil_;
+ typedef as2::nil_ nil_;
typedef as2::ref::empty_list<tag_>::type empty_;
{
typedef void_ u1_; typedef nil_ l_;
@@ -93,7 +92,7 @@
typedef mpl::apply2<
as2::ref::list_aux::policy<tag_>,
as2::ref::list_aux::void_,
- as2::ref::list_aux::nil
+ nil_
>::type po_; // just see that it compiles
}
{
@@ -114,7 +113,6 @@
BOOST_MPL_ASSERT(( is_same<val_, int const> ));
}
}
-
}
{
typedef int t_; typedef add_reference<t_>::type r_;
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-05 21:23:03 EDT (Tue, 05 Apr 2011)
@@ -49,9 +49,8 @@
}
{
//[tutorial_piping
- using namespace lambda;
std::deque<int> cont;
- range::stable_partition( cont | _csv_put( 0, 1, 2, 3, 4, 5 ), _1 % 2 );
+ range::stable_partition( cont | _csv_put( 0, 1, 2, 3, 4, 5 ), lambda::_1 % 2 );
//]
//[tutorial_container_generation
assert( range::equal( cont, csv_deque(1, 3, 5, 0, 2, 4) ) );
@@ -122,9 +121,9 @@
alternating[0] = -1; alternating[1] = +1;
alternating[2] = -2;
- C::size_type index = 3; using namespace lambda;
+ C::size_type index = 3;
(
- put( alternating ) % ( _iterate = var( index )++ )
+ put( alternating ) % ( _iterate = lambda::var( index )++ )
)( +2 )( -3 )( +3 )( -4 )( +4 )( -5 )( +5 );
assert(
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