Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69312 - in sandbox/assign_v2/boost/assign/v2: put/deduce put/deduce/fun utility utility/csv
From: erwann.rogard_at_[hidden]
Date: 2011-02-26 14:09:51


Author: e_r
Date: 2011-02-26 14:09:49 EST (Sat, 26 Feb 2011)
New Revision: 69312
URL: http://svn.boost.org/trac/boost/changeset/69312

Log:
assign_v2: csv stuff (continued)
Added:
   sandbox/assign_v2/boost/assign/v2/put/deduce/fun/
   sandbox/assign_v2/boost/assign/v2/put/deduce/fun.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/utility/csv/
   sandbox/assign_v2/boost/assign/v2/utility/csv.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/utility/csv/make.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/utility/csv/result.hpp (contents, props changed)

Added: sandbox/assign_v2/boost/assign/v2/put/deduce/fun.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/put/deduce/fun.hpp 2011-02-26 14:09:49 EST (Sat, 26 Feb 2011)
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_DEDUCE_FUN_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_DEDUCE_FUN_ER_2010_HPP
+#include <boost/mpl/eval_if.hpp>
+#include <boost/assign/v2/detail/traits/container/value.hpp>
+#include <boost/assign/v2/detail/traits/container/is_ptr_container.hpp>
+#include <boost/assign/v2/detail/functor/constructor.hpp>
+#include <boost/assign/v2/detail/functor/new.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_aux{
+
+ template<typename C>
+ struct deduce_fun_pointer
+ {
+ typedef typename v2::container_traits::value<C>::type value_type;
+ typedef functor_aux::new_<value_type> type;
+ };
+
+ template<typename C>
+ struct deduce_fun_value
+ {
+ typedef typename v2::container_traits::value<C>::type value_type;
+ typedef functor_aux::constructor<value_type> type;
+ };
+
+ template<typename C>
+ struct deduce_fun : boost::mpl::eval_if<
+ container_traits::is_ptr_container<C>,
+ deduce_fun_pointer<C>,
+ deduce_fun_value<C>
+ >
+ {};
+
+}// put_aux
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/assign_v2/boost/assign/v2/utility/csv.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/utility/csv.hpp 2011-02-26 14:09:49 EST (Sat, 26 Feb 2011)
@@ -0,0 +1,16 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_UTILITY_CSV_ER_2010_HPP
+#define BOOST_ASSIGN_V2_UTILITY_CSV_ER_2010_HPP
+
+#include <boost/assign/v2/utility/csv/result.hpp>
+#include <boost/assign/v2/utility/csv/make.hpp>
+
+#endif

Added: sandbox/assign_v2/boost/assign/v2/utility/csv/make.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/utility/csv/make.hpp 2011-02-26 14:09:49 EST (Sat, 26 Feb 2011)
@@ -0,0 +1,93 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_UTILITY_CSV_MAKE_ER_2010_HPP
+#define BOOST_ASSIGN_V2_UTILITY_CSV_MAKE_ER_2010_HPP
+#include <boost/mpl/vector.hpp>
+#include <boost/assign/v2/utility/csv/result.hpp>
+
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <utility>
+#else
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repetition.hpp>
+#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
+#endif
+
+namespace boost{
+namespace assign{
+namespace v2{
+
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+
+ template<typename F, typename T>
+ typename result_of::csv<F const&,
+ ::boost::mpl::vector<T>
+ >::type
+ csv( F const& functor, T&& t )
+ {
+ return functor( t );
+ }
+
+ template<typename F, typename T, typename Args>
+ typename result_of::csv<F const&,
+ ::boost::mpl::vector<T, Args...>
+ >::type
+ csv( F const& functor, T&& t, Args&&... args )
+ {
+ return csv( functor( t ), 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 F BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)>\
+ typename result_of::csv<F const&, \
+ ::boost::mpl::vector<BOOST_PP_ENUM(N, BOOST_ASSIGN_V2_MACRO1, &)>\
+ >::type\
+ csv( \
+ F const& functor\
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, T, & _)\
+ )\
+ {\
+ return functor BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO2, ~ );\
+ }\
+\
+ template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)>\
+ typename result_of::csv<F const&,\
+ ::boost::mpl::vector<BOOST_PP_ENUM(N, BOOST_ASSIGN_V2_MACRO1, const &)>\
+ >::type\
+ csv( \
+ F const& functor\
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, T, const & _)\
+ )\
+ {\
+ return functor BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO2, ~ );\
+ }\
+\
+/**/
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO3,
+ ~
+)
+#undef BOOST_ASSIGN_V2_MACRO1
+#undef BOOST_ASSIGN_V2_MACRO2
+#undef BOOST_ASSIGN_V2_MACRO3
+#endif BOOST_ASSIGN_V2_ENABLE_CPP0X
+
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/assign_v2/boost/assign/v2/utility/csv/result.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/utility/csv/result.hpp 2011-02-26 14:09:49 EST (Sat, 26 Feb 2011)
@@ -0,0 +1,59 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_UTILITY_CSV_RESULT_ER_2010_HPP
+#define BOOST_ASSIGN_V2_UTILITY_CSV_RESULT_ER_2010_HPP
+#include <boost/typeof/typeof.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/placeholders.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace csv_aux{
+
+ template<typename F, typename T>
+ struct unary_result
+ {
+ static F f;
+ static T t;
+ typedef BOOST_TYPEOF_TPL( f( t ) ) type;
+ };
+
+ template<typename F>
+ struct result
+ {
+
+ typedef F state_;
+
+ template<typename Vec>
+ struct apply : ::boost::mpl::fold<
+ Vec,
+ state_,
+ unary_result< ::boost::mpl::_1, ::boost::mpl::_2>
+ >{};
+
+ };
+
+}// csv_aux
+namespace result_of{
+
+ template<typename F, typename V>
+ struct csv : ::boost::mpl::apply1<
+ csv_aux::result<F>,
+ V
+ >{};
+
+}// nth_result_of
+}// 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