$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r71787 - in sandbox/assign_v2/boost/assign/v2: . interpreter put
From: erwann.rogard_at_[hidden]
Date: 2011-05-07 15:38:04
Author: e_r
Date: 2011-05-07 15:38:03 EDT (Sat, 07 May 2011)
New Revision: 71787
URL: http://svn.boost.org/trac/boost/changeset/71787
Log:
upd assign_v2
Text files modified: 
   sandbox/assign_v2/boost/assign/v2/interpreter.hpp             |     1                                         
   sandbox/assign_v2/boost/assign/v2/interpreter/as_arg_list.hpp |    21 ++++-----                               
   sandbox/assign_v2/boost/assign/v2/interpreter/crtp.hpp        |    78 +++++++++++++++++--------------------   
   sandbox/assign_v2/boost/assign/v2/interpreter/csv.hpp         |    81 ++++++++++++++++----------------------- 
   sandbox/assign_v2/boost/assign/v2/interpreter/fwd.hpp         |     3 +                                       
   sandbox/assign_v2/boost/assign/v2/put/csv_put.hpp             |     4                                         
   6 files changed, 86 insertions(+), 102 deletions(-)
Modified: sandbox/assign_v2/boost/assign/v2/interpreter.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/interpreter.hpp	(original)
+++ sandbox/assign_v2/boost/assign/v2/interpreter.hpp	2011-05-07 15:38:03 EDT (Sat, 07 May 2011)
@@ -10,6 +10,7 @@
 #ifndef BOOST_ASSIGN_V2_INTERPRETER_ER_2011_HPP
 #define BOOST_ASSIGN_V2_INTERPRETER_ER_2011_HPP
 #include <boost/assign/v2/interpreter/as_arg_list.hpp>
+#include <boost/assign/v2/interpreter/csv.hpp>
 #include <boost/assign/v2/interpreter/data.hpp>
 #include <boost/assign/v2/interpreter/crtp.hpp>
 #include <boost/assign/v2/interpreter/modifier.hpp>
Modified: sandbox/assign_v2/boost/assign/v2/interpreter/as_arg_list.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/interpreter/as_arg_list.hpp	(original)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/as_arg_list.hpp	2011-05-07 15:38:03 EDT (Sat, 07 May 2011)
@@ -22,27 +22,26 @@
     template<
         typename R    // Range
     >
-    class as_arg_list_adapter/*<-*/
+    struct as_arg_list_adapter 
+        : boost::iterator_range<
+            typename boost::range_iterator<R>::type
+        >/*<-*/
     {
-
-        typedef typename boost::range_iterator<R>::type ri_;
-        typedef boost::iterator_range<ri_> ir_;
+        
+        typedef boost::iterator_range<
+            typename boost::range_iterator<R>::type
+        > super_t;
+        
         public:
 
         as_arg_list_adapter(R& range)
-            :ir(
+            :super_t(
                 boost::make_iterator_range( range )
             )
         {}
 
-        typedef ir_ result_type;
-
-        result_type operator()()const{ return this->ir; }
-
         private:
         as_arg_list_adapter();
-        ir_ ir;
-
     }/*->*/;
 
 namespace result_of{
Modified: sandbox/assign_v2/boost/assign/v2/interpreter/crtp.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/interpreter/crtp.hpp	(original)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/crtp.hpp	2011-05-07 15:38:03 EDT (Sat, 07 May 2011)
@@ -17,11 +17,14 @@
 #include <boost/assign/v2/interpreter/fwd.hpp>
 #include <boost/assign/v2/interpreter/modifier.hpp>
 #include <boost/concept_check.hpp>
+#include <boost/function.hpp>
 #include <boost/mpl/always.hpp>
 #include <boost/mpl/apply.hpp>
 #include <boost/range/algorithm/for_each.hpp>
+#include <boost/range/reference.hpp>
 #include <boost/ref.hpp>
 #include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/remove_reference.hpp>
 #if BOOST_ASSIGN_V2_ENABLE_CPP0X
 #include <utility>
 #else
@@ -63,41 +66,6 @@
 
     };
 
-    template<typename D>
-    struct wrapper
-    {
-
-        wrapper(D const& d):d_( d ){}
-
-        operator D const&()const{ return this->d_; }
-
-        typedef wrapper const& result_type;
-
-#if BOOST_ASSIGN_V2_ENABLE_CPP0X
-        template<typename T>
-        result_type operator()( T&& t )const
-        {
-            this->d_( std::forward<T>(t) ); return (*this);
-        }
-#else
-
-        template<typename T>
-        result_type operator()(T& t)const
-        {
-            this->d_( t ); return (*this);
-        }
-
-        template<typename T>
-        result_type operator()(T const & t)const
-        {
-            this->d_( t ); return (*this);
-        }
-#endif
-
-        private:
-        D const& d_;
-
-    };
 }// interpreter_aux
 //[syntax_interpreter_crtp
 namespace interpreter_aux{
@@ -180,13 +148,6 @@
 
         typedef D const& result_type;
 
-        template<typename R>
-        result_type
-        operator()( as_arg_list_adapter<R> range )const/*<-*/
-        {
-             return ::boost::for_each( range(), wrapper<D>( this->derived() ) );
-        }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
-
 //<-
 #if BOOST_ASSIGN_V2_ENABLE_CPP0X
 //->
@@ -199,6 +160,12 @@
             );
         }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
 
+        template<typename R>
+        result_type as_arg_list( R&& range )const/*<-*/
+        {
+            return this->as_arg_list_impl( std::forward<R>( range ) );
+        }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+    
 //<-
 #else
         protected:
@@ -215,6 +182,20 @@
             return this->modify( this->fun() );
         }
 
+        template<typename R>
+        result_type
+        as_arg_list( R& range )const/*<-*/
+        {
+            return this->as_arg_list_impl( range );
+        }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+
+        template<typename R>
+        result_type
+        as_arg_list( R const& range )const/*<-*/
+        {
+            return this->as_arg_list_impl( range );
+        }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+
 #define BOOST_ASSIGN_V2_MACRO(z, N, data) \
     template<BOOST_PP_ENUM_PARAMS(N, typename T)> \
     result_type \
@@ -230,6 +211,7 @@
     ~
 )
 #undef BOOST_ASSIGN_V2_MACRO
+
 #endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
 
         // must be mutable
@@ -283,6 +265,18 @@
 
 #endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
 
+        template<typename R>
+        result_type
+        as_arg_list_impl( BOOST_ASSIGN_V2_FORWARD_PARAM(R, range) )const/*<-*/
+        {
+            typedef typename boost::range_reference<
+                typename boost::remove_reference<R>::type
+            >::type t_;
+            boost::function<result_type ( t_ )> f = boost::cref( *this );
+            boost::for_each( BOOST_ASSIGN_V2_FORWARD_ARG(R, range), f );
+            return this->derived();
+        }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+
 //->
     };
 
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-05-07 15:38:03 EDT (Sat, 07 May 2011)
@@ -9,20 +9,12 @@
 //////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_ASSIGN_V2_INTERPRETER_CSV_ER_2011_HPP
 #define BOOST_ASSIGN_V2_INTERPRETER_CSV_ER_2011_HPP
+#include <boost/assign/v2/interpreter/crtp.hpp>
+#include <boost/assign/v2/interpreter/as_arg_list.hpp>
 #include <boost/assign/v2/support/config/enable_cpp0x.hpp>
 #include <boost/assign/v2/support/pp/ignore.hpp>
-#include <boost/assign/v2/interpreter/fwd.hpp>
-#include <boost/config.hpp>
-#include <boost/mpl/bool.hpp>
 #if BOOST_ASSIGN_V2_ENABLE_CPP0X
 #include <utility>
-#else
-#include <boost/assign/v2/support/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
 
 namespace boost{
 namespace assign{
@@ -30,16 +22,37 @@
 //[syntax_interpreter_csv
 namespace interpreter_aux{
 
-//<-
-#if BOOST_ASSIGN_V2_ENABLE_CPP0X
-//->
-
     template<typename D, typename C, typename F, typename MTag, typename DTag>
     void csv(
         interpreter_crtp<D, C, F, MTag, DTag> const& interpreter
     )/*<-*/
     {
     }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+
+    template<
+        typename D, typename C, typename F, typename MTag, typename DTag, 
+        typename R
+    >
+    void invoke(
+        interpreter_crtp<D, C, F, MTag, DTag> const& interpreter,
+        as_arg_list_adapter<R>&& adapter
+    )/*<-*/
+    {
+        interpreter.as_arg_list( std::forward<T>( adapter ) );
+    }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+
+    template<
+        typename D, typename C, typename F, typename MTag, typename DTag, 
+        typename T
+    >
+    void invoke(
+        interpreter_crtp<D, C, F, MTag, DTag> const& interpreter,
+        T&& t
+    )/*<-*/
+    {
+        interpreter( std::forward<T>( t ) );
+    }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+        
     template<typename D, typename C, typename F, typename MTag, typename DTag,  
         typename T, typename... Args>
     void csv(
@@ -48,48 +61,22 @@
     )/*<-*/
     {
         return csv(
-            interpreter( std::forward<T>( t ) ),
+            invoke( interpreter, t ),
             std::forward<Args>( args )...
         );
     }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
 
 //]
-#else
-#define BOOST_ASSIGN_V2_MACRO1(z, i, data) ( BOOST_PP_CAT(_, i) )
-#define BOOST_ASSIGN_V2_MACRO2(z, N, is_const)\
-    template<\
-         typename D, typename C, typename F, typename MTag, typename DTag\
-        BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)\
-    >\
-    void csv(\
-        interpreter_crtp<D, C, F, MTag, DTag> const& interpreter\
-        BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(\
-            N, T, BOOST_PP_EXPR_IF(is_const, const) & _\
-        )\
-    )\
-    {\
-        interpreter BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO1, ~ );\
-    }\
-/**/
-
-BOOST_PP_REPEAT_FROM_TO(
-    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_MACRO2,
-    1
-)
-#undef BOOST_ASSIGN_V2_MACRO1
-#undef BOOST_ASSIGN_V2_MACRO2
-#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
 
 }// interpreter_aux
 }// v2
 }// assign
 }// boost
 
+#else
+
+#include <boost/assign/v2/interpreter/cpp03/csv.hpp>
+
+#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
+
 #endif // BOOST_ASSIGN_V2_INTERPRETER_CSV_ER_2011_HPP
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-05-07 15:38:03 EDT (Sat, 07 May 2011)
@@ -53,6 +53,9 @@
     template<typename Derived> struct replace_modifier_tag;
     template<typename Derived> struct replace_data_tag;
 
+    template<typename R>
+    class as_arg_list_adapter;
+
 }// interpreter_aux
 }// v2
 }// assign
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-05-07 15:38:03 EDT (Sat, 07 May 2011)
@@ -9,11 +9,11 @@
 //////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_ASSIGN_V2_PUT_CSV_PUT_ER_2011_HPP
 #define BOOST_ASSIGN_V2_PUT_CSV_PUT_ER_2011_HPP
-#include <boost/assign/v2/support/config/enable_cpp0x.hpp>
-#include <boost/assign/v2/support/pp/ignore.hpp>
 #include <boost/assign/v2/interpreter/csv.hpp>
 #include <boost/assign/v2/option/data.hpp>
 #include <boost/assign/v2/put/put.hpp>
+#include <boost/assign/v2/support/config/enable_cpp0x.hpp>
+#include <boost/assign/v2/support/pp/ignore.hpp>
 #include <boost/utility/enable_if.hpp>
 #if BOOST_ASSIGN_V2_ENABLE_CPP0X
 #include <utility>