|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68510 - in sandbox/assign_v2/boost/assign/v2/put/pipe: csv functor modulo
From: erwann.rogard_at_[hidden]
Date: 2011-01-27 18:50:12
Author: e_r
Date: 2011-01-27 18:50:11 EST (Thu, 27 Jan 2011)
New Revision: 68510
URL: http://svn.boost.org/trac/boost/changeset/68510
Log:
upd assign_v2
Added:
sandbox/assign_v2/boost/assign/v2/put/pipe/csv/rhs.hpp (contents, props changed)
sandbox/assign_v2/boost/assign/v2/put/pipe/functor/rhs.hpp (contents, props changed)
sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/
sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/forward.hpp (contents, props changed)
sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/size_type.hpp (contents, props changed)
sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/traits.hpp (contents, props changed)
Added: sandbox/assign_v2/boost/assign/v2/put/pipe/csv/rhs.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/put/pipe/csv/rhs.hpp 2011-01-27 18:50:11 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,66 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_PIPE_CSV_RHS_HPP_ER_2010
+#define BOOST_ASSIGN_V2_PUT_PIPE_CSV_RHS_HPP_ER_2010
+#include <boost/mpl/apply.hpp>
+#include <boost/assign/v2/ref/array/csv.hpp>
+#include <boost/assign/v2/put/pipe/modulo/size_type.hpp>
+#include <boost/assign/v2/put/pipe/modulo/traits.hpp>
+#include <boost/assign/v2/put/pipe/csv/size_type.hpp>
+
+namespace boost{
+ struct use_default;
+namespace assign{
+namespace v2{
+namespace put_pipe_aux{
+
+ template<typename Pars, csv_size_type N, typename U>
+ struct csv_rhs
+ {
+ typedef boost::use_default tag2_;
+ typedef modulo_traits<Pars> modulo_traits_;
+ typedef typename modulo_traits_::size pars_size;
+ typedef typename modulo_traits_::cont_ pars_cont_type;
+ typedef typename v2::ref::nth_result_of::csv_array<
+ N,
+ U
+ >::type seq_arg_cont_type; //notice it's arg, not args
+
+ csv_rhs(){}
+ csv_rhs(pars_cont_type const& p, seq_arg_cont_type const& s)
+ : pars_cont( p ), seq_arg( s ){}
+
+ pars_cont_type const& pars()const
+ {
+ return this->pars_cont;
+ }
+
+ seq_arg_cont_type const& seq_args()const
+ {
+ return this->seq_arg;
+ }
+ seq_arg_cont_type& seq_args()
+ {
+ return this->seq_arg;
+ }
+
+ protected:
+ pars_cont_type pars_cont;
+ seq_arg_cont_type seq_arg;
+
+ };
+
+}// put_pipe_aux
+}// v2
+}// assign
+}// boost
+
+#endif
+
Added: sandbox/assign_v2/boost/assign/v2/put/pipe/functor/rhs.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/put/pipe/functor/rhs.hpp 2011-01-27 18:50:11 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,272 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_PIPE_FUNCTOR_RHS_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_PIPE_FUNCTOR_RHS_ER_2010_HPP
+#include <boost/mpl/vector/vector0.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/apply.hpp>
+
+#include <boost/assign/v2/put/pipe/modulo/size_type.hpp>
+#include <boost/assign/v2/put/pipe/modulo/traits.hpp>
+
+#include <boost/assign/v2/ref/list_tuple.hpp>
+
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <utility>
+#include <boost/assign/v2/temporary/variadic_vector.hpp>
+#else
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/repetition.hpp>
+#include <boost/assign/v2/detail/functor/crtp_unary_and_up.hpp>
+#endif
+
+namespace boost{
+ struct use_default;
+namespace assign{
+namespace v2{
+namespace put_pipe_aux{
+
+ template<
+ typename Pars = ::boost::mpl::vector0<>,
+ typename SeqArgs = ::boost::mpl::vector0<>,
+ bool enable_pars = (boost::mpl::size<SeqArgs>::value == 0)
+ >
+ class rhs;
+
+ template<typename Pars, typename SeqArgs, bool enable_pars>
+ struct rhs_result_helper
+ {
+
+ template<typename V>
+ struct apply
+ {
+ typedef typename ::boost::mpl::push_back<
+ SeqArgs,
+ V
+ >::type new_;
+ typedef put_pipe_aux::rhs<
+ Pars,
+ new_
+ > type;
+ };
+
+ };
+
+#if! BOOST_ASSIGN_V2_ENABLE_CPP0X
+ typedef ref::list_tuple_aux::na_type na_type;
+#endif
+
+ template<typename Pars, typename SeqArgs, bool enable_pars>
+ struct rhs_result
+ {
+ typedef rhs_result_helper<
+ Pars,
+ SeqArgs,
+ enable_pars
+ > helper_;
+
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+
+ template<typename...Args>
+ struct apply : helper_::template apply<
+ typename ::boost::mpl::detail::variadic_vector<
+ Args...
+ >::type
+ >
+ {};
+
+#else
+
+ template<typename V>
+ struct apply : helper_::template apply<V>{};
+
+#endif
+
+ };
+
+
+ template<typename Pars, typename SeqArgs, bool enable_pars>
+ class rhs
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+//do nothing
+#else
+ : public functor_aux::crtp_unary_and_up<
+ rhs<Pars, SeqArgs, enable_pars>,
+ rhs_result<Pars, SeqArgs, enable_pars>
+ >
+#endif
+ {
+ typedef boost::use_default list_tag_;
+ typedef modulo_traits<Pars> modulo_traits_;
+ typedef ref::nth_result_of::list_tuple meta2_;
+
+ public:
+
+ typedef typename modulo_traits_::size pars_size;
+ typedef typename modulo_traits_::cont_ pars_cont_type;
+
+ BOOST_STATIC_CONSTANT(
+ std::size_t,
+ seq_args_size = ::boost::mpl::size<SeqArgs>::value
+ );
+
+ typedef typename ::boost::mpl::apply1<
+ meta2_,
+ SeqArgs
+ >::type seq_args_cont_type;
+
+ rhs(){}
+ explicit rhs(
+ pars_cont_type const& p,
+ seq_args_cont_type const& s
+ ) : pars_cont( p ),
+ seq_args_cont( s ){}
+
+ // operator%
+
+ template<typename T>
+ struct modulo_result
+ {
+ typedef typename modulo_traits_:: template new_pars<T>::type new_;
+ typedef rhs<new_, SeqArgs> type;
+ };
+
+ template<typename T>
+ typename boost::lazy_enable_if_c<
+ enable_pars,
+ modulo_result<T>
+ >::type
+ operator%(T const& t)const
+ {
+ typedef typename modulo_result<T>::type result_;
+ return result_(
+ this->pars_cont( t ),
+ this->seq_args_cont
+ );
+ }
+
+ // operator()
+
+ template<
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+ typename...Args
+#else
+ typename VArgs
+#endif
+ >
+ struct result : rhs_result<
+ Pars,
+ SeqArgs,
+ enable_pars
+ >::template apply<
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+ Args...
+#else
+ VArgs
+#endif
+ >{};
+
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+
+ public:
+
+ template<typename ...Args>
+ typename result<Args...>::type
+ operator()(Args&&...args )const
+ {
+ typedef typename result<Args...>::type result_;
+ return result_(
+ this->pars_cont,
+ this->seq_args_cont(
+ std::forward<Args>( args )...
+ )
+ );
+ }
+
+#else
+ protected:
+
+ typedef functor_aux::crtp_unary_and_up<
+ rhs,
+ rhs_result<Pars, SeqArgs, enable_pars>
+ > super_t;
+
+ typedef ::boost::mpl::vector0<> v0_;
+
+ public:
+
+ typename result<v0_>::type
+ operator()()const
+ {
+ typedef typename result<v0_>::type result_;
+ return result_(
+ this->pars_cont,
+ this->seq_args_cont()
+ );
+ }
+
+ using super_t::operator();
+
+#define MACRO1( z, n, data )\
+ ( BOOST_PP_CAT(_,n) )\
+/**/
+#define MACRO2(z, N1, data)\
+ template<BOOST_PP_ENUM_PARAMS(N1, typename U)>\
+ typename result<\
+ ::boost::mpl::vector<\
+ BOOST_PP_ENUM_PARAMS(N1, U)\
+ >\
+ >::type\
+ impl( BOOST_PP_ENUM_BINARY_PARAMS(N1, U, &_) )const{\
+ typedef ::boost::mpl::vector<\
+ BOOST_PP_ENUM_PARAMS(N1, U)\
+ > v_;\
+ typedef typename result<v_>::type result_;\
+ return result_(\
+ this->pars_cont,\
+ this->seq_args_cont( BOOST_PP_ENUM_PARAMS(N1, _) )\
+ );\
+ }\
+/**/
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_ARITY),
+ MACRO2,
+ ~
+)
+#undef MACRO1
+#undef MACRO2
+
+#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
+
+ pars_cont_type const& pars()const
+ {
+ return this->pars_cont;
+ }
+ seq_args_cont_type const& seq_args()const
+ {
+ return this->seq_args_cont;
+ }
+
+ protected:
+
+ pars_cont_type pars_cont;
+ seq_args_cont_type seq_args_cont;
+
+ };
+
+}// put_pipe_aux
+}// v2
+}// assign
+}// boost
+
+#endif // BOOST_ASSIGN_V2_PUT_PIPE_CONTAINER_ER_2010_HPP
Added: sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/forward.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/forward.hpp 2011-01-27 18:50:11 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,89 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_PIPE_MODULO_FORWARD_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_PIPE_MODULO_FORWARD_ER_2010_HPP
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/assign/v2/put/modulo.hpp>
+#include <boost/assign/v2/put/pipe/modulo/size_type.hpp>
+#include <boost/assign/v2/ref/list/at.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_pipe_aux{
+namespace result_of{
+
+ template<modulo_size_type N, typename Pars, typename T,
+ bool exit = (N == ::boost::mpl::size<Pars>::value)>
+ struct forward_pars
+ {
+ typedef typename ::boost::mpl::at_c<Pars, N>::type at_;
+ typedef result_of_modulo::generic_<T> meta_;
+ typedef typename ::boost::mpl::apply1<meta_, at_>::type new_t_;
+
+ typedef forward_pars<N+1, Pars, new_t_> next_;
+
+ typedef typename next_::type type;
+
+ template<typename H>
+ static type call(H const& h, T const& t)
+ {
+ typedef ::boost::mpl::int_<N> int_;
+ return next_::call(h, t % ref::at<N>( h ) );
+ }
+
+ };
+
+ template<modulo_size_type N,typename Pars, typename T>
+ struct forward_pars<N, Pars, T, true>
+ {
+
+ typedef T type;
+
+ template<typename H>
+ static type call(H const& h, T const& t)
+ {
+ return t;
+ }
+
+ };
+
+}// result_of
+
+ template<typename Pars, typename T,typename C>
+ typename result_of::forward_pars<0, Pars, T>::type
+ forward_pars(
+ T const& object,
+ C const& c
+ )
+ {
+ typedef result_of::forward_pars<0, Pars, T> caller_;
+ return caller_::call( c, object );
+ }
+
+}// put_pipe_aux
+namespace result_of{
+
+ template<typename T,typename Pars>
+ struct forward_pars : put_pipe_aux::result_of::forward_pars<
+ 0,
+ Pars,
+ T
+ >{};
+
+}// result_of
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/size_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/size_type.hpp 2011-01-27 18:50:11 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,26 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_MODULO_SIZE_TYPE_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_MODULO_SIZE_TYPE_ER_2010_HPP
+#include <boost/assign/v2/ref/list/size_type.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_pipe_aux{
+
+ typedef ref::list_aux::size_type modulo_size_type;
+
+}// put_pipe_aux
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/put/pipe/modulo/traits.hpp 2011-01-27 18:50:11 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,43 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_PIPE_MODULO_TRAITS_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_PIPE_MODULO_TRAITS_ER_2010_HPP
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/assign/v2/ref/list/at.hpp>
+#include <boost/assign/v2/ref/list/container.hpp>
+#include <boost/assign/v2/ref/list/nth_result_of.hpp>
+#include <boost/assign/v2/ref/list/make.hpp>
+
+namespace boost{
+ struct use_default;
+namespace assign{
+namespace v2{
+namespace put_pipe_aux{
+
+ template<typename Pars>
+ struct modulo_traits
+ {
+ typedef ref::nth_result_of::list<use_default> meta_;
+ typedef typename ::boost::mpl::apply1<meta_, Pars>::type cont_;
+ typedef typename ::boost::mpl::size<Pars>::type size;
+
+ template<typename T>
+ struct new_pars : ::boost::mpl::push_back<Pars, T const&>{};
+
+ };
+
+}// put_pipe_aux
+}// v2
+}// assign
+}// boost
+
+#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