Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66538 - sandbox/statistics/support/boost/assign/v2/put/generic
From: erwann.rogard_at_[hidden]
Date: 2010-11-12 11:37:11


Author: e_r
Date: 2010-11-12 11:37:08 EST (Fri, 12 Nov 2010)
New Revision: 66538
URL: http://svn.boost.org/trac/boost/changeset/66538

Log:
adding dir boost/assign/v2/put/generic
Added:
   sandbox/statistics/support/boost/assign/v2/put/generic/
   sandbox/statistics/support/boost/assign/v2/put/generic/base.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/put/generic/crtp.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/put/generic/expose_fun.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/put/generic/expose_modifier.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/put/generic/generic.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/put/generic/new_fun.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/put/generic/new_modifier.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/put/generic/result_of_modulo.hpp (contents, props changed)

Added: sandbox/statistics/support/boost/assign/v2/put/generic/base.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/generic/base.hpp 2010-11-12 11:37:08 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,25 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_GENERIC_BASE_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_GENERIC_BASE_ER_2010_HPP
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_aux{
+
+ struct put_base{};
+
+}// put_aux
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/put/generic/crtp.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/generic/crtp.hpp 2010-11-12 11:37:08 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,187 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_GENERIC_CRTP_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_GENERIC_CRTP_ER_2010_HPP
+#include <boost/preprocessor/arithmetic/add.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repeat_from_to.hpp>
+#include <boost/mpl/always.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/range/reference.hpp>
+
+#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
+#include <boost/assign/v2/detail/config/limit_arity.hpp>
+#include <boost/assign/v2/detail/type_traits/container/is_ptr_container.hpp>
+#include <boost/assign/v2/detail/functor/functor.hpp>
+#include <boost/assign/v2/detail/keyword/keyword.hpp>
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+
+#include <boost/assign/v2/put/modifier/modifier.hpp>
+#include <boost/assign/v2/put/generic/result_of_modulo.hpp>
+#include <boost/assign/v2/put/generic/expose_modifier.hpp>
+#include <boost/assign/v2/put/generic/expose_fun.hpp>
+#include <boost/assign/v2/put/generic/base.hpp>
+
+// --------------- //
+// Usage //
+// --------------- //
+// Calling
+// put( v )( a )()( c0, c11 );
+//
+// ----- csv syntax ------
+//
+// put( v )( a )( T() )( T(c0, c11) );
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_aux{
+
+ // T = container_type_traits::value<V>::type
+ template<typename V>
+ struct crtp_traits
+ {
+ typedef typename v2::container_type_traits::value<V>::type value_type;
+ typedef typename boost::mpl::eval_if<
+ container_type_traits::is_ptr_container<V>,
+ functor_aux::deduce_new_<V>,
+ functor_aux::deduce_constructor<V>
+ >::type functor_type;
+ typedef typename put_aux::deduce_modifier<V>::type modifier_tag;
+
+ };
+
+ // Requirements:
+ // d.unwrap() returns a reference to V&
+ // D d(U v, F const& f); Constructs an object, d, of type D.
+ // Usually, f is passed to the crtp. U = V& or V const& depending on need.
+ // Traits are deprecated but a use may be find in the future.
+ template<typename V,typename F, typename Tag, typename D, typename Traits>
+ class crtp :
+ public put_base,
+ public put_aux::expose_fun<F>, // protect + friend?
+ public put_aux::expose_modifier<Tag>, // protect + friend?
+ public functor_aux::crtp_unary_and_up<
+ crtp<V, F, Tag, D, Traits>,
+ boost::mpl::always< D const& >
+ >
+ {
+
+ public:
+ typedef D const& result_type;
+
+ protected:
+
+ typedef functor_aux::crtp_unary_and_up<
+ crtp,
+ boost::mpl::always<result_type>
+ > super_t;
+
+ typedef expose_modifier<Tag> expose_modifier_;
+ typedef typename expose_modifier_::modifier_type modifier_;
+ typedef expose_fun<F> expose_fun_;
+
+ public:
+
+ D & derived(){ return static_cast<D&>(*this); }
+ D const& derived()const{ return static_cast<D const&>(*this); }
+
+ //public:
+
+ crtp(){}
+ explicit crtp( F const& f ) : expose_fun_( f ){}
+ explicit crtp( F const& f, modifier_ const& m )
+ : expose_fun_( f ), expose_modifier_( m ){}
+
+ using super_t::operator();
+ result_type operator()()const
+ {
+ return this->arg_deduct( this->fun() );
+ }
+
+#define BOOST_ASSIGN_V2_impl(z, N, data) \
+ template<BOOST_PP_ENUM_PARAMS(N, typename T)> \
+ result_type \
+ impl( BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _) )const \
+ { \
+ return this->arg_deduct( this->fun(BOOST_PP_ENUM_PARAMS(N,_)) ); \
+ } \
+/**/
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_ARITY),
+ BOOST_ASSIGN_V2_impl,
+ ~
+)
+#undef BOOST_ASSIGN_V2_impl
+
+ V& unwrap()const{ return this->derived().unwrap(); }
+
+ struct result_of_modulo{
+
+ struct deduce
+ {
+ typedef functor_aux::deduce_constructor<V> caller_;
+ typedef typename caller_::type cons_;
+ typedef typename boost::mpl::apply1<
+ v2::result_of_modulo::new_fun<D>,
+ cons_
+ >::type type;
+ };
+
+ };
+
+ typename result_of_modulo::deduce::type
+ modulo_deduce()const
+ {
+ typedef functor_aux::deduce_constructor<V> caller_;
+ typedef typename caller_::type cons_;
+ typedef typename result_of_modulo::deduce::type result_;
+ return result_(
+ this->derived().unwrap(),
+ caller_::call()
+ );
+ }
+
+ protected:
+
+ template<typename T>
+ result_type arg_deduct(T* t)const
+ {
+ this->modifier.impl( this->derived().unwrap(), t );
+ return this->derived();
+ }
+
+ template<typename T>
+ result_type arg_deduct(T& t)const
+ {
+ this->modifier.impl( this->derived().unwrap(), t );
+ return this->derived();
+ }
+
+ template<typename T>
+ result_type arg_deduct(T const& t)const
+ {
+ this->modifier.impl( this->derived().unwrap(), t );
+ return this->derived();
+ }
+ };
+
+}// put_aux
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/put/generic/expose_fun.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/generic/expose_fun.hpp 2010-11-12 11:37:08 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,36 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_GENERIC_HOLD_FUN_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_GENERIC_HOLD_FUN_ER_2010_HPP
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_aux{
+
+ template<typename F>
+ struct expose_fun{
+
+ typedef F fun_type;
+
+ expose_fun(){}
+ expose_fun(fun_type const& f) : fun( f ){}
+
+ fun_type fun;
+
+ };
+
+
+}// put_aux
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/put/generic/expose_modifier.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/generic/expose_modifier.hpp 2010-11-12 11:37:08 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,39 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_GENERIC_HOLD_MODIFIER_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_GENERIC_HOLD_MODIFIER_ER_2010_HPP
+#include <boost/assign/v2/put/modifier/def.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_aux{
+
+ template<typename Tag>
+ struct expose_modifier{
+
+ typedef Tag modifier_tag;
+ typedef put_aux::modifier<Tag> modifier_type;
+
+ expose_modifier(){}
+ expose_modifier(modifier_type const& m) : modifier( m ){}
+
+ typedef put_aux::modifier<Tag> modifier_;
+
+ modifier_type modifier;
+
+ };
+
+}// put_aux
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/put/generic/generic.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/generic/generic.hpp 2010-11-12 11:37:08 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,20 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_GENERIC_GENERIC_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_GENERIC_GENERIC_ER_2010_HPP
+
+#include <boost/assign/v2/put/generic/crtp.hpp>
+#include <boost/assign/v2/put/generic/expose_fun.hpp>
+#include <boost/assign/v2/put/generic/expose_modifier.hpp>
+#include <boost/assign/v2/put/generic/new_fun.hpp>
+#include <boost/assign/v2/put/generic/new_modifier.hpp>
+#include <boost/assign/v2/put/generic/result_of_modulo.hpp>
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/put/generic/new_fun.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/generic/new_fun.hpp 2010-11-12 11:37:08 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,65 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_GENERIC_NEW_FUN_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_GENERIC_NEW_FUN_ER_2010_HPP
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/void.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/assign/v2/put/generic/result_of_modulo.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_aux{
+
+ template<typename F>
+ struct new_fun
+ {
+
+ new_fun(const F& f) : value(f){}
+
+ F value;
+ };
+
+ template<typename T,typename F1>
+ typename boost::mpl::apply1<result_of_modulo::new_fun<T>, F1>::type
+ operator%(
+ T const& t,
+ put_aux::new_fun<F1> const& h
+ )
+ {
+ typedef typename boost::mpl::apply1<
+ result_of_modulo::new_fun<T>,
+ F1
+ >::type result_;
+ return result_( t.unwrap(), h.value, t.modifier );
+ }
+
+ struct kwd_fun{
+
+ template<typename F>
+ put_aux::new_fun<F>
+ operator=(F const& f)const
+ {
+ return put_aux::new_fun<F>( f );
+ }
+
+ };
+
+}// keyword_aux
+namespace{
+ const put_aux::kwd_fun _fun = put_aux::kwd_fun();
+}
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/put/generic/new_modifier.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/generic/new_modifier.hpp 2010-11-12 11:37:08 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,69 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_GENERIC_NEW_MODIFIER_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_GENERIC_NEW_MODIFIER_ER_2010_HPP
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/void.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/assign/v2/put/generic/result_of_modulo.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_aux{
+
+ template<typename Tag> struct set_modifier
+ {
+
+ set_modifier(){}
+ set_modifier(Tag const& t) : modifier_tag( t ){}
+
+ Tag modifier_tag;
+ };
+
+ struct new_modifier
+ {
+
+ template<typename Tag>
+ set_modifier<Tag> operator=( Tag const& t)const
+ {
+ return set_modifier<Tag>( t );
+ }
+
+ };
+
+ template<typename T,typename NewTag>
+ typename boost::mpl::apply1<
+ v2::result_of_modulo::new_modifier<T>,
+ NewTag
+ >::type
+ operator%(
+ T const& t,
+ put_aux::set_modifier<NewTag> const& h
+ )
+ {
+ typedef typename boost::mpl::apply1<
+ v2::result_of_modulo::new_modifier<T>,
+ NewTag
+ >::type result_;
+ typedef put_aux::modifier<NewTag> modifier_;
+ return result_( t.unwrap(), t.fun, modifier_( h.modifier_tag ) );
+ }
+
+}// put_aux
+namespace{
+ put_aux::new_modifier const _modifier = put_aux::new_modifier();
+}
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/put/generic/result_of_modulo.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/generic/result_of_modulo.hpp 2010-11-12 11:37:08 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,81 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_GENERIC_RESULT_OF_MODULO_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_GENERIC_RESULT_OF_MODULO_ER_2010_HPP
+#include <boost/mpl/apply.hpp>
+#include <boost/typeof/typeof.hpp>
+
+namespace boost{
+ struct use_default;
+namespace assign{
+namespace v2{
+namespace result_of_modulo{
+
+ template<typename T> struct new_fun{
+
+ template<typename F> struct apply{};
+
+ };
+
+ template<typename T> struct new_modifier{
+
+ template<typename Tag> struct apply{};
+
+ };
+ template<typename T> struct new_fun_modifier
+ {
+
+ template<typename F,typename Tag>
+ struct apply
+ {
+ typedef typename boost::mpl::apply1<
+ new_fun<T>,
+ F
+ >::type new_fun_;
+ typedef result_of_modulo::new_modifier<new_fun_> new_modifier_;
+ typedef typename boost::mpl::apply1<
+ new_modifier_,
+ Tag
+ >::type type;
+ };
+
+ };
+
+ template<typename T>
+ struct generic
+ {
+
+ template<typename P>
+ struct apply
+ {
+ static T t;
+ static P p;
+ typedef BOOST_TYPEOF_TPL( t % p ) type; // TODO workaround MSVC
+ };
+
+ };
+
+
+}// result_of_modulo
+
+/*
+ struct deduce
+ {
+ typedef functor_aux::deduce_constructor<V> caller_;
+ typedef typename caller_::type cons_;
+ typedef typename Traits::template new_fun<cons_>::type type;
+ };
+*/
+
+}// 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