Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72450 - in sandbox/assign_v2/boost/assign/v2/interpreter: cpp03 csv
From: erwann.rogard_at_[hidden]
Date: 2011-06-06 21:27:43


Author: e_r
Date: 2011-06-06 21:27:42 EDT (Mon, 06 Jun 2011)
New Revision: 72450
URL: http://svn.boost.org/trac/boost/changeset/72450

Log:
upd assign_v2
Added:
   sandbox/assign_v2/boost/assign/v2/interpreter/cpp03/csv_basic.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/interpreter/cpp03/csv_ext.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/interpreter/csv/
   sandbox/assign_v2/boost/assign/v2/interpreter/csv/csv_basic.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/interpreter/csv/csv_ext.hpp (contents, props changed)

Added: sandbox/assign_v2/boost/assign/v2/interpreter/cpp03/csv_basic.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/cpp03/csv_basic.hpp 2011-06-06 21:27:42 EDT (Mon, 06 Jun 2011)
@@ -0,0 +1,73 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2011 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_INTERPRETER_CPP03_CSV_BASIC_ER_2011_HPP
+#define BOOST_ASSIGN_V2_INTERPRETER_CPP03_CSV_BASIC_ER_2011_HPP
+#include <boost/assign/v2/interpreter/crtp.hpp>
+#include <boost/assign/v2/support/config/limit_csv_arity.hpp>
+
+#define BOOST_ASSIGN_V2_INTERPRETER_CSV_OVERLOAD_BASIC(z, N, is_const)\
+ template<\
+ BOOST_PP_ENUM_PARAMS(N, typename T)\
+ BOOST_PP_COMMA_IF(N)\
+ typename D, typename C, typename F, typename MTag, typename DTag\
+ >\
+ D const& csv(\
+ interpreter_crtp<D, C, F, MTag, DTag> const& interpreter,\
+ BOOST_PP_ENUM_BINARY_PARAMS(\
+ N, T, BOOST_PP_EXPR_IF(is_const, const) & _\
+ )\
+ )\
+ {\
+ interpreter( _0 );\
+ return csv(\
+ interpreter\
+ BOOST_PP_COMMA_IF( BOOST_PP_DEC(N) )\
+ BOOST_PP_ENUM_SHIFTED_PARAMS(N, _ )\
+ );\
+ }\
+/**/
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace interpreter_aux{
+
+ template<typename D, typename C, typename F, typename MTag, typename DTag>
+ D const& csv(
+ interpreter_crtp<D, C, F, MTag, DTag> const& interpreter
+ )
+ {
+ return static_cast<D const&>( interpreter );
+ }
+
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_INTERPRETER_CSV_OVERLOAD_BASIC,
+ 0
+)
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_INTERPRETER_CSV_OVERLOAD_BASIC,
+ 1
+)
+
+#undef BOOST_ASSIGN_V2_INTERPRETER_CSV_OVERLOAD_BASIC
+
+}// interpreter_aux
+
+using interpreter_aux::csv;
+
+}// v2
+}// assign
+}// boost
+
+#endif // BOOST_ASSIGN_V2_INTERPRETER_CPP03_CSV_BASIC_ER_2011_HPP

Added: sandbox/assign_v2/boost/assign/v2/interpreter/cpp03/csv_ext.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/cpp03/csv_ext.hpp 2011-06-06 21:27:42 EDT (Mon, 06 Jun 2011)
@@ -0,0 +1,161 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2011 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_INTERPRETER_CPP03_CSV_EXT_ER_2011_HPP
+#define BOOST_ASSIGN_V2_INTERPRETER_CPP03_CSV_EXT_ER_2011_HPP
+#include <boost/assign/v2/interpreter/crtp.hpp>
+#include <boost/assign/v2/support/config/limit_csv_arity.hpp>
+#include <boost/assign/v2/support/config/limit_functor_arity.hpp>
+#include <boost/assign/v2/support/config/limit_functor_const_non_const_arity.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#define BOOST_ASSIGN_V2_INTERPRETER_CSV_EXIT(z, J, data)\
+ template<\
+ int I, BOOST_PP_ENUM_PARAMS(J, typename T)\
+ , typename D, typename C, typename F, typename MTag, typename DTag\
+ >\
+ typename boost::enable_if_c<\
+ I == J,\
+ D const&\
+ >::type\
+ csv\
+ (\
+ interpreter_crtp<D, C, F, MTag, DTag> const& interpreter\
+ )\
+ {\
+ return static_cast<D const&>( interpreter );\
+ }\
+/**/
+
+#define BOOST_ASSIGN_V2_INTERPRETER_CSV_NESTED_ITER(z, N, SeqU)\
+ template<\
+ int I, BOOST_ASSIGN_V2_TPL_PARAMETER_LIST(SeqU)\
+ , typename D, typename C, typename F, typename MTag, typename DTag\
+ >\
+ typename boost::enable_if_c<\
+ I == BOOST_PP_SEQ_SIZE(SeqU),\
+ D const&\
+ >::type\
+ csv\
+ (\
+ interpreter_crtp<D, C, F, MTag, DTag> const& interpreter,\
+ BOOST_ASSIGN_V2_CSV_PARAMETER_LIST(SeqU, N)\
+ )\
+ {\
+ interpreter(\
+ BOOST_ASSIGN_V2_ARG_LIST(SeqU, 0)\
+ );\
+ return csv<I, BOOST_PP_SEQ_ENUM(SeqU)>(\
+ static_cast<D const&>( interpreter )\
+ BOOST_PP_ENUM_TRAILING(\
+ BOOST_PP_MUL( BOOST_PP_DEC(N), BOOST_PP_SEQ_SIZE(SeqU) ),\
+ BOOST_ASSIGN_V2_CSV_ARG_LIST_ITER,\
+ BOOST_PP_SEQ_SIZE(SeqU)\
+ )\
+ );\
+ }\
+/**/
+
+#define BOOST_ASSIGN_V2_INTERPRETER_CSV_ITER(r, SeqU)\
+ BOOST_PP_REPEAT_FROM_TO(\
+ 1,\
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),\
+ BOOST_ASSIGN_V2_INTERPRETER_CSV_NESTED_ITER,\
+ SeqU\
+ )\
+/**/
+
+// CONST_NON_CONST_OVERLOAD
+
+#define BOOST_ASSIGN_V2_INTERPRETER_CSV_CONST_NON_CONST_OVERLOAD(z, I, data)\
+ BOOST_PP_SEQ_FOR_EACH_PRODUCT(\
+ BOOST_ASSIGN_V2_INTERPRETER_CSV_ITER,\
+ BOOST_ASSIGN_V2_CSV_SEQ1(I)\
+ )\
+/**/
+
+// OVERLOAD
+
+#define BOOST_ASSIGN_V2_INTERPRETER_CSV_OVERLOAD(z, I, pos)\
+ BOOST_ASSIGN_V2_INTERPRETER_CSV_ITER(\
+ ~,\
+ BOOST_ASSIGN_V2_CSV_SEQ2(pos, I)\
+ )\
+/**/
+
+// OVERLOAD_VARIADIC
+
+#define BOOST_ASSIGN_V2_INTERPRETER_CSV_OVERLOAD_VARIADIC(z, N, is_const)\
+ template<\
+ BOOST_PP_ENUM_PARAMS(N, typename T)\
+ BOOST_PP_COMMA_IF(N)\
+ typename D, typename C, typename F, typename MTag, typename DTag\
+ >\
+ D const& csv(\
+ interpreter_crtp<D, C, F, MTag, DTag> const& interpreter,\
+ BOOST_PP_ENUM_BINARY_PARAMS(\
+ N, T, BOOST_PP_EXPR_IF(is_const, const) & _\
+ )\
+ )\
+ {\
+ interpreter( _0 );\
+ return csv(\
+ interpreter\
+ BOOST_PP_COMMA_IF( BOOST_PP_DEC(N) )\
+ BOOST_PP_ENUM_SHIFTED_PARAMS(N, _ )\
+ );\
+ }\
+/**/
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace interpreter_aux{
+
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_FUNCTOR_ARITY),
+ BOOST_ASSIGN_V2_INTERPRETER_CSV_EXIT,
+ ~
+)
+
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_FUNCTOR_CONST_NON_CONST_ARITY),
+ BOOST_ASSIGN_V2_INTERPRETER_CSV_CONST_NON_CONST_OVERLOAD,
+ ~
+)
+
+BOOST_PP_REPEAT_FROM_TO(
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_FUNCTOR_CONST_NON_CONST_ARITY),
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_FUNCTOR_ARITY),
+ BOOST_ASSIGN_V2_INTERPRETER_CSV_OVERLOAD,
+ 0
+)
+
+BOOST_PP_REPEAT_FROM_TO(
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_FUNCTOR_CONST_NON_CONST_ARITY),
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_FUNCTOR_ARITY),
+ BOOST_ASSIGN_V2_INTERPRETER_CSV_OVERLOAD,
+ 1
+)
+
+#undef BOOST_ASSIGN_V2_INTERPRETER_CSV_EXIT
+#undef BOOST_ASSIGN_V2_INTERPRETER_CSV_NESTED_ITER
+#undef BOOST_ASSIGN_V2_INTERPRETER_CSV_ITER
+#undef BOOST_ASSIGN_V2_INTERPRETER_CSV_CONST_NON_CONST_OVERLOAD
+#undef BOOST_ASSIGN_V2_INTERPRETER_CSV_OVERLOAD
+
+}// interpreter_aux
+
+}// v2
+}// assign
+}// boost
+
+#endif // BOOST_ASSIGN_V2_INTERPRETER_CPP03_CSV_ER_2011_HPP

Added: sandbox/assign_v2/boost/assign/v2/interpreter/csv/csv_basic.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/csv/csv_basic.hpp 2011-06-06 21:27:42 EDT (Mon, 06 Jun 2011)
@@ -0,0 +1,45 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2011 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_INTERPRETER_CSV_BASIC_ER_2011_HPP
+#define BOOST_ASSIGN_V2_INTERPRETER_CSV_BASIC_ER_2011_HPP
+#include <boost/assign/v2/support/config/enable_cpp0x.hpp>
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <boost/assign/v2/interpreter/csv/csv_ext.hpp>
+#include <boost/assign/v2/support/pp/ignore.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+//[syntax_interpreter_csv_basic
+namespace interpreter_aux{
+
+ template<
+ typename D, typename C, typename F, typename MTag, typename DTag,
+ typename... Args
+ >
+ D const&
+ csv(
+ interpreter_crtp<D, C, F, MTag, DTag> const& interpreter,
+ Args&&... args
+ )/*<-*/
+ {
+ return csv<1>( interpreter, std::forward<Args>( args )... );
+ }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+
+}// interpreter_aux
+//]
+}// v2
+}// assign
+}// boost
+
+#else
+#include <boost/assign/v2/interpreter/cpp03/csv_basic.hpp>
+#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
+#endif // BOOST_ASSIGN_V2_INTERPRETER_CSV_BASIC_ER_2011_HPP

Added: sandbox/assign_v2/boost/assign/v2/interpreter/csv/csv_ext.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/interpreter/csv/csv_ext.hpp 2011-06-06 21:27:42 EDT (Mon, 06 Jun 2011)
@@ -0,0 +1,265 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2011 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_INTERPRETER_CSV_EXT_ER_2011_HPP
+#define BOOST_ASSIGN_V2_INTERPRETER_CSV_EXT_ER_2011_HPP
+#include <boost/assign/v2/interpreter/crtp.hpp>
+#include <boost/assign/v2/support/config/enable_cpp0x.hpp>
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <boost/assign/v2/support/mpl/variadic_args_to_indices.hpp>
+#include <boost/assign/v2/support/pp/ignore.hpp>
+#include <boost/assign/v2/support/traits/type/add_ref_const.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <utility>
+#include <tuple>
+
+namespace boost{
+namespace assign{
+namespace v2{
+//[syntax_interpreter_csv_ext
+namespace interpreter_aux{
+
+ template<
+ int I,
+ typename... Cast,
+ typename D, typename C, typename F, typename MTag, typename DTag,
+ typename... Args
+ >
+ D const&
+ csv(
+ interpreter_crtp<D, C, F, MTag, DTag> const& interpreter,
+ Args&&... args
+ );
+
+//<-
+ template<int I, int K, typename...Cast>
+ struct csv_tail
+ {
+ template<typename D, typename T, typename ...Args>
+ static D const& call( D const& interpreter, T&& /*drop*/, Args&&...args )
+ {
+ typedef csv_tail<I, K + 1, Cast...> next_;
+ return next_::call(
+ interpreter,
+ std::forward<Args>( args )...
+ );
+ }
+ };
+
+ template<int I, typename...Cast>
+ struct csv_tail<I, I, Cast...>
+ {
+ template<typename D, typename ...Args>
+ static D const& call( D const& interpreter, Args&&...args)
+ {
+ return csv<I, Cast...>(
+ interpreter, std::forward<Args>( args )...
+ );
+ }
+ };
+
+ template<
+ int I, typename Head, typename Tail,
+ bool exit = ( pack_holder_size<int, Head>::value == I )
+ > struct csv_cast{};
+
+ template<int I, typename...Head, typename U, typename...Tail>
+ struct csv_cast<
+ I,
+ pack_holder<Head...>,
+ pack_holder<U, Tail...>,
+ false
+ > : csv_cast<
+ I,
+ pack_holder<Head..., U>,
+ pack_holder<Tail...>
+ >
+ {};
+
+ template<int I, typename... Head, typename... Tail>
+ struct csv_cast<I, pack_holder<Head...>, pack_holder<Tail...>, true >
+ {
+ typedef pack_holder<Head...> type;
+ };
+
+ template<typename NextTuple, int ...Values, typename Tuple, typename T>
+ NextTuple
+ csv_next_tuple(// TODO weird warning : unused parameter 'tu'
+ indices<int, Values...>,
+ Tuple&& tu,
+ T&& t
+ )
+ {
+ return NextTuple(
+ get<Values>( std::forward<Tuple>( tu ) )...,
+ std::forward<T>( t )
+ );
+ }
+
+ template<typename T> struct csv_tuple_elem{};
+ template<typename T> struct csv_tuple_elem<T&>{ typedef T& type; };
+ template<typename T> struct csv_tuple_elem<T&&>{
+ typedef T type;
+ };
+
+ template<typename ...Args>
+ struct csv_tuple
+ {
+ typedef std::tuple<
+ typename csv_tuple_elem<Args>::type...
+ > type;
+ };
+
+ template<int I, typename HeadPack, typename ArgsPack,
+ bool exit = pack_holder_size<int, HeadPack>::value == I
+ >
+ struct csv_tuple_head{};
+
+ template<int I, typename ...Head, typename...Args>
+ struct csv_tuple_head<
+ I, pack_holder<Head...>, pack_holder<Args...>, true
+ >
+ {
+ typedef typename csv_tuple<Head&&...>::type type;
+
+ static type call(type&& tu, Args&&... /*unused*/)
+ {
+ return tu;
+ }
+ };
+
+ template<int I, typename ...Head, typename T, typename...Args>
+ struct csv_tuple_head<
+ I,
+ pack_holder<Head...>,
+ pack_holder<T, Args...>,
+ false
+ >
+ {
+ typedef typename csv_tuple<Head&&...>::type tuple_;
+ typedef csv_tuple_head<
+ I,
+ pack_holder<Head..., T>,
+ pack_holder<Args...>
+ > next_;
+ typedef typename next_::type type;
+
+ static type call(tuple_&& tu, T&& t, Args&&... args)
+ {
+ typedef typename head_indices<
+ int, sizeof...(Head)
+ >::type indices_;
+ typedef typename csv_tuple<Head&&..., T&&>::type next_tuple_;
+ return next_::call(
+ csv_next_tuple< next_tuple_ >(
+ indices_(),
+ std::forward<tuple_>( tu ),
+ std::forward<T>( t )
+ ),
+ std::forward<Args>( args )...
+ );
+ }
+
+ };
+
+ template<typename D, typename...Cast>
+ void csv_invoke_helper(D const& interpreter, Cast...args)
+ {
+ interpreter( args...);
+ }
+
+ template<typename D, int...Values, typename...Cast, typename Tuple>
+ void csv_invoke(
+ D const& interpreter,
+ indices<int, Values...>,
+ pack_holder<Cast...>,
+ Tuple&& tu
+ )
+ {
+ csv_invoke_helper<D, Cast...>(
+ interpreter,
+ get<Values>( std::forward<Tuple>( tu ) )...
+ );
+ }
+
+ template<
+ int I,
+ typename... Cast,
+ typename D, typename C, typename F, typename MTag, typename DTag
+ >
+ D const&
+ csv(
+ interpreter_crtp<D, C, F, MTag, DTag> const& interpreter
+ )
+ {
+ return static_cast<D const&>( interpreter );
+ }
+
+ template<
+ int I,
+ typename... Cast,
+ typename D, typename C, typename F, typename MTag, typename DTag,
+ typename... Args
+ >
+ D const&
+ csv(
+ interpreter_crtp<D, C, F, MTag, DTag> const& interpreter,
+ Args&&... args
+ )
+ {
+ {
+ typedef pack_holder<
+ typename type_traits::add_ref_const<Cast>::type...
+ > head_;
+ typedef pack_holder<Args...> tail_;
+ typedef typename csv_cast<I, head_, tail_>::type cast_;
+
+ typedef csv_tuple_head<
+ I, pack_holder<>, pack_holder<Args...>
+ > make_tuple_;
+
+ typedef typename head_indices<int, I>::type indices_;
+ typedef std::tuple<> init_;
+ csv_invoke(
+ interpreter,
+ indices_(),
+ cast_(),
+ make_tuple_::call
+ (
+ init_(),
+ std::forward<Args>( args )...
+ )
+ );
+ }
+ {
+ typedef csv_tail<I, 0, Cast...> tail_;
+ return tail_::call(
+ static_cast<D const&>( interpreter ),
+ std::forward<Args>( args )...
+ );
+ }
+ }
+
+//->
+
+}// interpreter_aux
+
+using interpreter_aux::csv;
+
+//]
+}// v2
+}// assign
+}// boost
+
+#else
+#include <boost/assign/v2/interpreter/cpp03/csv_ext.hpp>
+#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
+
+#endif // BOOST_ASSIGN_V2_INTERPRETER_CSV_EXT_ER_2011_HPP


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