Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69830 - in sandbox/assign_v2/boost/assign/v2: put put/container put/frame put/modifier/iterate put/modifier/lookup put/modifier/repeat put/pipe ref/array utility/conversion
From: erwann.rogard_at_[hidden]
Date: 2011-03-10 17:18:33


Author: e_r
Date: 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
New Revision: 69830
URL: http://svn.boost.org/trac/boost/changeset/69830

Log:
update assign_v2
Text files modified:
   sandbox/assign_v2/boost/assign/v2/put/container.hpp | 1
   sandbox/assign_v2/boost/assign/v2/put/container/put_range.hpp | 52 --------------------------------------
   sandbox/assign_v2/boost/assign/v2/put/frame/crtp.hpp | 53 +++++++++++++++++++++++++++++++++++++++
   sandbox/assign_v2/boost/assign/v2/put/modifier/iterate/impl.hpp | 28 +++++++++++++-------
   sandbox/assign_v2/boost/assign/v2/put/modifier/iterate/tag.hpp | 24 ++++++++++++++++-
   sandbox/assign_v2/boost/assign/v2/put/modifier/lookup/impl.hpp | 4 +-
   sandbox/assign_v2/boost/assign/v2/put/modifier/repeat/impl.hpp | 3 -
   sandbox/assign_v2/boost/assign/v2/put/modifier/repeat/tag.hpp | 3 +
   sandbox/assign_v2/boost/assign/v2/put/pipe.hpp | 2
   sandbox/assign_v2/boost/assign/v2/put/pipe/range.hpp | 3 ++
   sandbox/assign_v2/boost/assign/v2/ref/array/conversion.hpp | 3 ++
   sandbox/assign_v2/boost/assign/v2/utility/conversion/convert.hpp | 4 ++
   sandbox/assign_v2/boost/assign/v2/utility/conversion/converter.hpp | 1
   13 files changed, 108 insertions(+), 73 deletions(-)

Modified: sandbox/assign_v2/boost/assign/v2/put/container.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/container.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/container.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -12,6 +12,5 @@
 #include <boost/assign/v2/put/container/adapter.hpp>
 #include <boost/assign/v2/put/container/fwd.hpp>
 #include <boost/assign/v2/put/container/put.hpp>
-#include <boost/assign/v2/put/container/put_range.hpp>
 
 #endif // BOOST_ASSIGN_V2_PUT_CONTAINER_ER_2010_HPP

Modified: sandbox/assign_v2/boost/assign/v2/put/container/put_range.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/container/put_range.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/container/put_range.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -1,51 +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_PUT_CONTAINER_PUT_RANGE_ER_2010_HPP
-#define BOOST_ASSIGN_V2_PUT_CONTAINER_PUT_RANGE_ER_2010_HPP
-#include <boost/assign/v2/put/container/put.hpp>
-#include <boost/range/algorithm/for_each.hpp>
-
-namespace boost{
-namespace assign{
-namespace v2{
-namespace result_of{
-
- template<typename /*<<C& has to be a reference>>*/C, typename R, bool binary = true>
- struct put_range
- {
- typedef C& type;
- };
-
- template<typename C, typename R>
- struct put_range<C, R>
- {
- typedef C type;
- };
-
-}// result_of
-
- template<typename C, typename R>
- C& put_range( C& cont, R const& r )
- {
- return ::boost::for_each( r, put( cont ) ).container();
- }
-
- template<typename C, typename R>
- C put_range( R const& r )
- {
- C cont;
- return put_range( cont, r );
- }
-
-}// v2
-}// assign
-}// boost
-
-#endif // BOOST_ASSIGN_V2_PUT_CONTAINER_PUT_RANGE_ER_2010_HPP
+// TODO remove file
\ No newline at end of file

Modified: sandbox/assign_v2/boost/assign/v2/put/frame/crtp.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/frame/crtp.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/frame/crtp.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -9,14 +9,17 @@
 //////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_ASSIGN_V2_PUT_FRAME_CRTP_ER_2010_HPP
 #define BOOST_ASSIGN_V2_PUT_FRAME_CRTP_ER_2010_HPP
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
 #include <boost/assign/v2/detail/pp/forward.hpp>
 #include <boost/assign/v2/detail/traits/container/is_ptr_container.hpp>
+#include <boost/assign/v2/put/frame/as_arg_list.hpp>
 #include <boost/assign/v2/put/frame/fwd.hpp>
 #include <boost/assign/v2/put/frame/modifier.hpp>
 #include <boost/mpl/always.hpp>
 #include <boost/mpl/apply.hpp>
+#include <boost/range/algorithm/for_each.hpp>
+#include <boost/ref.hpp>
 #include <boost/utility/enable_if.hpp>
-#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
 #if BOOST_ASSIGN_V2_ENABLE_CPP0X
 #include <utility>
 #else
@@ -60,6 +63,46 @@
 
     };
 
+ 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_(
+ /*<< Instance of F >>*/ this->fun( std::forward<Args>(args)... )
+ );
+ 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_;
+
+ };
+
+
     // D has to model concept_sub::Pre3, with respect to container C, functor F
     // and Tag. It then models concept_sub::Post
     template<typename C, typename F, typename Tag, typename D>
@@ -93,6 +136,14 @@
         explicit crtp( F const& f, modifier_ const& m )
             : fun_holder_( f ), modifier_holder_( m ){}
 
+ template<typename R>
+ result_type
+ operator()( as_arg_list_adapter<R> range )const
+ {
+ return ::boost::for_each( range(), wrapper<D>( this->derived() ) );
+ }
+
+
 #if BOOST_ASSIGN_V2_ENABLE_CPP0X
 
         //[frame_crtp_functor

Modified: sandbox/assign_v2/boost/assign/v2/put/modifier/iterate/impl.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/modifier/iterate/impl.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/modifier/iterate/impl.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -10,10 +10,11 @@
 #ifndef BOOST_ASSIGN_V2_PUT_MODIFIER_ITERATE_IMPL_ER_2010_HPP
 #define BOOST_ASSIGN_V2_PUT_MODIFIER_ITERATE_IMPL_ER_2010_HPP
 #include <boost/assign/v2/detail/keyword/ignore.hpp>
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
 #include <boost/assign/v2/put/frame/modifier.hpp>
 #include <boost/assign/v2/put/modifier/iterate/tag.hpp>
-
-#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/shared_ptr.hpp>
 #if BOOST_ASSIGN_V2_ENABLE_CPP0X
 #include <utility>
 #include <boost/type_traits/is_reference.hpp>
@@ -30,12 +31,17 @@
     {
 
                 typedef keyword_aux::ignore ignore_;
+ typedef Arg arg_;
+ // storing a copy of lambda::something has caused pbs, hence ptr
+ typedef boost::shared_ptr<arg_> ptr_;
                     
         public:
                     
- modifier(){}
- explicit modifier( ignore_, Arg arg )
- : arg_( arg )
+ modifier(): ptr( new arg_() ){}
+ explicit modifier(
+ ignore_,
+ typename boost::call_traits<arg_>::param_type arg
+ ) : ptr( new arg_( arg ) )
         {}
 
 #if BOOST_ASSIGN_V2_ENABLE_CPP0X
@@ -46,7 +52,7 @@
>::type
         impl(C& cont, T&& t )const
         {
- cont.at( this->arg_() ) = std::move( t ); // TODO ?
+ cont.at( (*this->ptr)() ) = std::move( t );
         }
 
 #endif
@@ -54,17 +60,19 @@
         template<typename C, typename T>
         void impl(C& cont, T& t )const
         {
- cont.at( this->arg_() ) = t;
+ cont.at( (*this->ptr)() ) = t;
         }
-
+
+ // TODO verify
         template<typename C, typename T>
         void impl(C& cont, T* t)const
         {
- cont.replace( this->arg_() , t);
+ cont.replace( this->arg_() , t);
         }
                     
         protected:
- mutable Arg arg_;
+ ptr_ ptr;
+
     };
 
 }// put_aux

Modified: sandbox/assign_v2/boost/assign/v2/put/modifier/iterate/tag.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/modifier/iterate/tag.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/modifier/iterate/tag.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -9,14 +9,34 @@
 //////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_ASSIGN_V2_PUT_MODIFIER_ITERATE_TAG_ER_2010_HPP
 #define BOOST_ASSIGN_V2_PUT_MODIFIER_ITERATE_TAG_ER_2010_HPP
-#include <boost/assign/v2/detail/functor/post_increment.hpp>
+#include <cstddef>
+//#include <boost/lambda/lambda.hpp>
+//#include <boost/typeof/typeof.hpp>
 
 namespace boost{
 namespace assign{
 namespace v2{
 namespace modifier_tag{
 
- template<typename Arg = functor_aux::post_increment<> > struct iterate{};
+ // TODO think of lambda expression
+ struct iterate_arg
+ {
+
+ typedef std::size_t result_type;
+
+ iterate_arg():i( 0 ){}
+ iterate_arg( result_type i_ ):i( i_ ){}
+
+ result_type operator()()const{ return this->i++; }
+
+ typedef iterate_arg type;
+
+ private:
+ mutable result_type i;
+ };
+
+
+ template<typename Arg = iterate_arg::type > struct iterate{};
 
 }// modifier_tag
 }// v2

Modified: sandbox/assign_v2/boost/assign/v2/put/modifier/lookup/impl.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/modifier/lookup/impl.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/modifier/lookup/impl.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -24,13 +24,13 @@
     {
 
         typedef Arg arg_;
- // storing a copy of Arg has caused problems with lambda::, hence ptr
+ // storing a copy of lambda::something has caused pbs, hence ptr
         typedef boost::shared_ptr<arg_> ptr_;
                 typedef keyword_aux::ignore ignore_;
                 
         public:
 
- modifier(){}
+ modifier() : ptr( new arg_() ){}
         explicit modifier(
                 ignore_,
             typename boost::call_traits<arg_>::param_type arg

Modified: sandbox/assign_v2/boost/assign/v2/put/modifier/repeat/impl.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/modifier/repeat/impl.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/modifier/repeat/impl.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -36,8 +36,7 @@
         modifier() : n_( 0 ){}
         explicit modifier( inner_type inner, size_type n )
             : inner_( inner ), n_( n )
- {
- }
+ {}
 
 #if BOOST_ASSIGN_V2_ENABLE_CPP0X
                 template<typename C, typename T>

Modified: sandbox/assign_v2/boost/assign/v2/put/modifier/repeat/tag.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/modifier/repeat/tag.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/modifier/repeat/tag.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -16,7 +16,8 @@
 namespace v2{
 namespace modifier_tag{
 
- template<typename /*<<Arg is the modifier-tag of the implementation to override>>*/> struct repeat{};
+ template<typename /*<<Arg is the modifier-tag of the implementation to override>>*/ Arg>
+ struct repeat{};
 
 }// modifier_tag
 }// v2

Modified: sandbox/assign_v2/boost/assign/v2/put/pipe.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/pipe.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/pipe.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -11,6 +11,6 @@
 #define BOOST_ASSIGN_V2_PUT_PIPE_ER_2010_HPP
 #include <boost/assign/v2/put/pipe/csv_put.hpp>
 #include <boost/assign/v2/put/pipe/put.hpp>
-#include <boost/assign/v2/put/pipe/range.hpp>
+//#include <boost/assign/v2/put/pipe/range.hpp>
 
 #endif // BOOST_ASSIGN_V2_PUT_PIPE_ER_2010_HPP

Modified: sandbox/assign_v2/boost/assign/v2/put/pipe/range.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put/pipe/range.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put/pipe/range.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -1,3 +1,5 @@
+// TODO keep in working copy
+/*
 //////////////////////////////////////////////////////////////////////////////
 // Boost.Assign v2 //
 // //
@@ -66,3 +68,4 @@
 }// boost
 
 #endif // BOOST_ASSIGN_V2_PUT_PIPE_RANGE_ER_2010_HPP
+*/

Modified: sandbox/assign_v2/boost/assign/v2/ref/array/conversion.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/array/conversion.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/ref/array/conversion.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -27,6 +27,9 @@
 #undef BOOST_ASSIGN_V2_R
 
 }// array_aux
+
+using array_aux::convert;
+
 }// ref
 }// v2
 }// assign

Modified: sandbox/assign_v2/boost/assign/v2/utility/conversion/convert.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/conversion/convert.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/conversion/convert.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -11,6 +11,7 @@
 #define BOOST_ASSIGN_V2_UTILITY_CONVERSION_CONVERT_ER_2010_HPP
 #include <boost/assign/v2/put/container/put_range.hpp>
 #include <boost/assign/v2/utility/conversion/deduce_tag.hpp>
+#include <boost/range/algorithm/for_each.hpp>
 
 namespace boost{
 namespace assign{
@@ -21,7 +22,7 @@
     C convert(R const& r, convert_tag::put)
     {
         C cont;
- return v2::put_range( cont, r );
+ return ::boost::for_each( r, put( cont ) ).container();
     }
 
     template<typename C, typename R>
@@ -45,6 +46,7 @@
     struct convert{ typedef C type; };
 
 }//result_of
+
 }// v2
 }// assign
 }// boost

Modified: sandbox/assign_v2/boost/assign/v2/utility/conversion/converter.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/conversion/converter.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/conversion/converter.hpp 2011-03-10 17:18:29 EST (Thu, 10 Mar 2011)
@@ -73,7 +73,6 @@
 }// assign
 }// boost
 
-
 #if defined( BOOST_ASSIGN_V2_UTILITY_CONVERSION_CONVERTER_NAME_LOOKUP_PARAM ) || defined ( BOOST_ASSIGN_V2_UTILITY_CONVERSION_CONVERTER_NAME_LOOKUP )
 #error
 #endif


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