|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60572 - in sandbox/statistics/detail/assign/boost/assign/auto_size: chain reference_wrapper
From: erwann.rogard_at_[hidden]
Date: 2010-03-13 21:48:46
Author: e_r
Date: 2010-03-13 21:48:45 EST (Sat, 13 Mar 2010)
New Revision: 60572
URL: http://svn.boost.org/trac/boost/changeset/60572
Log:
m
Added:
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/conversion_traits.hpp (contents, props changed)
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/generalized_auto_convert.hpp (contents, props changed)
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/generalized_chain.hpp (contents, props changed)
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/inner_value_traits.hpp (contents, props changed)
sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/conversion_traits.hpp (contents, props changed)
sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/inner_value_traits.hpp (contents, props changed)
Added: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/conversion_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/conversion_traits.hpp 2010-03-13 21:48:45 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,64 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::conversion_traits.hpp //
+// //
+// (C) Copyright 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_DETAIL_CONVERSION_TRAITS_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_CONVERSION_TRAITS_ER_2010_HPP
+#include <boost/mpl/identity.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/assign/auto_size/chain/inner_value_traits.hpp>
+
+namespace boost{
+namespace assign{
+namespace detail{
+
+namespace conversion_traits{
+
+ namespace tag{
+ struct itself{ typedef itself type; };
+ struct reference_to_inner_value{
+ typedef reference_to_inner_value type;
+ };
+
+ // Add as needed
+ }
+
+ // Specialize as needed
+ template<typename T> struct tag_of : tag::itself{};
+
+ namespace meta{
+ template<typename T> struct identity : boost::mpl::identity<T>{};
+
+ template<typename Tag> struct convert_to{};
+
+ template<>
+ struct convert_to<conversion_traits::tag::itself>{
+ template<typename T> struct apply : identity<T>{};
+ };
+
+ template<>
+ struct convert_to<conversion_traits::tag::reference_to_inner_value>{
+ template<typename T>
+ struct apply : boost::add_reference<
+ typename detail::inner_value_traits::inner_value_of<T>::type
+ >{};
+ };
+ // Specialize further as needed
+ }// meta
+
+ template<typename T>
+ struct convert_to
+ : meta::convert_to<
+ typename conversion_traits::tag_of<T>::type
+ >::template apply<T>{};
+
+}// conversion_traits
+}// detail
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/generalized_auto_convert.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/generalized_auto_convert.hpp 2010-03-13 21:48:45 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,107 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::generalized_auto_convert.hpp //
+// //
+// (C) Copyright 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_DETAIL_GENERALIZED_AUTO_CONVERT_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_GENERALIZED_AUTO_CONVERT_ER_2010_HPP
+#include <boost/mpl/vector.hpp>
+#include <boost/fusion/include/make_vector.hpp>
+#include <boost/assign/auto_size/chain/auto_convert.hpp>
+#include <boost/assign/auto_size/chain/generalized_chain.hpp>
+
+namespace boost{
+namespace assign{
+
+namespace result_of{
+namespace chain_auto_convert{
+
+ namespace impl{
+ template<typename Conv>
+ struct binary{
+ template<typename R1,typename R2>
+ struct apply
+ : result_of::chain_auto_convert::generic<Conv,R1,R2>{};
+ };
+ }
+ template<typename Conv,typename Seq>
+ struct generalized_generic
+ : result_of::generalized_chain::generic<
+ result_of::chain_auto_convert::impl::binary<Conv>,
+ Seq
+ >{};
+
+ template<typename Seq>
+ struct generalized_apply_conversion
+ : result_of::chain_auto_convert::generalized_generic<
+ detail::pair_traits::meta::apply_conversion,
+ Seq
+ >
+ {};
+
+}// chain_auto_convert
+}// result_of
+
+
+ template<typename Conv,typename R1,typename R2,typename R3>
+ typename result_of::chain_auto_convert::generalized_generic<
+ Conv,
+ boost::mpl::vector3<R1,R2,R3>
+ >::type
+ chain_auto_convert(R1& r1, R2& r2, R3& r3){
+ typedef boost::mpl::vector3<R1,R2,R3> seq_;
+ typedef result_of::chain_auto_convert::generalized_generic<
+ Conv,
+ seq_
+ > caller_;
+ return caller_::call(
+ boost::fusion::make_vector(r1,r2,r3)
+ );
+ }
+
+ template<typename Conv,typename R1,typename R2,typename R3>
+ typename result_of::chain_auto_convert::generalized_generic<
+ Conv,
+ boost::mpl::vector3<const R1,const R2,const R3>
+ >::type
+ chain_auto_convert(const R1& r1, const R2& r2, const R3& r3){
+ typedef boost::mpl::vector3<const R1,const R2,const R3> seq_;
+ typedef result_of::chain_auto_convert::generalized_generic<
+ Conv,
+ seq_
+ > caller_;
+ return caller_::call(
+ boost::fusion::make_vector(r1,r2,r3)
+ );
+ }
+
+ // default :
+
+ template<typename R1,typename R2,typename R3>
+ typename result_of::chain_auto_convert::generalized_apply_conversion<
+ boost::mpl::vector3<R1,R2,R3>
+ >::type
+ chain_auto_convert(R1& r1, R2& r2, R3& r3){
+ typedef detail::pair_traits::meta::apply_conversion conv_;
+ return chain_auto_convert<conv_,R1,R2,R3>(r1,r2,r3);
+ }
+
+ template<typename R1,typename R2,typename R3>
+ typename result_of::chain_auto_convert::generalized_apply_conversion<
+ boost::mpl::vector3<const R1,const R2,const R3>
+ >::type
+ chain_auto_convert(const R1& r1, const R2& r2, const R3& r3){
+ typedef detail::pair_traits::meta::apply_conversion conv_;
+ return chain_auto_convert<conv_,R1,R2,R3>(r1,r2,r3);
+ }
+
+
+ // TODO BOOST_PP for 5, 6 etc.
+
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/generalized_chain.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/generalized_chain.hpp 2010-03-13 21:48:45 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,107 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::generalized_chain.hpp //
+// //
+// (C) Copyright 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_DETAIL_GENERALIZED_CHAIN_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_GENERALIZED_CHAIN_ER_2010_HPP
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/begin_end.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/next.hpp>
+#include <boost/mpl/distance.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/fusion/include/iterator.hpp>
+#include <boost/fusion/include/begin.hpp>
+#include <boost/fusion/include/end.hpp>
+
+namespace boost{
+namespace assign{
+namespace result_of{
+namespace generalized_chain{
+
+ namespace impl{
+
+ template<typename Binary,typename R1,typename R2>
+ struct caller : Binary::template apply<
+ typename boost::add_const<R1>::type,
+ typename boost::add_const<R2>::type
+ >{};
+
+ template<typename F,typename L>
+ struct exit_cond;
+
+ template<typename Binary,typename F,typename L,
+ bool exit = exit_cond<F,L>::value>
+ struct generic{
+
+ typedef typename boost::mpl::deref<F>::type arg1_;
+ typedef typename boost::mpl::next<F>::type next_it_;
+ typedef typename impl::generic<Binary,next_it_,L> next_;
+ typedef typename next_::type arg2_;
+ typedef generalized_chain::impl::caller<Binary,arg1_,arg2_> caller_;
+ typedef typename caller_::type type;
+
+ BOOST_STATIC_CONSTANT(int,iteration = next_::iteration + 1);
+
+ template<typename F1,typename L1>
+ static type call(const F1& f,const L1& l){
+ return caller_::call(
+ boost::fusion::deref(f),
+ next_::call(boost::fusion::next(f),l)
+ );
+ }
+
+ // Usage: call(boost::fusion::make_vector(r1,...,ri));
+ template<typename Seq1>
+ static type call(const Seq1& seq){
+ return call(boost::fusion::begin(seq),boost::fusion::end(seq));
+ }
+
+ };
+
+ template<typename F,typename L>
+ struct exit_cond
+ : boost::mpl::equal_to<
+ typename boost::mpl::distance<F,L>::type,
+ boost::mpl::int_<2>
+ >{};
+
+ template<typename Binary,typename F,typename L>
+ struct generic<Binary,F,L,true>{
+ BOOST_STATIC_CONSTANT( int, iteration = 2 );
+
+ typedef typename boost::mpl::deref<F>::type arg1_;
+ typedef typename boost::mpl::next<F>::type next_it_;
+ typedef typename boost::mpl::deref<next_it_>::type arg2_;
+
+ typedef generalized_chain::impl::caller<Binary,arg1_,arg2_> caller_;
+ typedef typename caller_::type type;
+
+ template<typename F1,typename L1>
+ static type call(const F1& f, const L1& l){
+ return caller_::call(
+ boost::fusion::deref(f),
+ boost::fusion::deref(boost::fusion::next(f))
+ );
+ }
+ };
+ }
+
+ template<typename Binary,typename Seq>
+ struct generic : result_of::generalized_chain::impl::generic<
+ Binary,
+ typename boost::mpl::begin<Seq>::type,
+ typename boost::mpl::end<Seq>::type
+ >{};
+
+}// generalized_chain
+}// result_of
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/inner_value_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/inner_value_traits.hpp 2010-03-13 21:48:45 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,54 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::inner_value_traits.hpp //
+// //
+// (C) Copyright 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_DETAIL_INNER_VALUE_TRAITS_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_INNER_VALUE_TRAITS_ER_2010_HPP
+
+namespace boost{
+namespace assign{
+namespace detail{
+
+namespace inner_value_traits{
+
+ namespace tag{
+ struct nested_parameter{ typedef nested_parameter type; };
+ }// tag
+
+ // Specialize as needed
+ template<typename T> struct tag_of : tag::nested_parameter{};
+
+ namespace meta{
+ struct empty{ template<typename T> struct apply{}; };
+
+ template<typename Tag> struct inner_value_of{};
+
+ template<>
+ struct inner_value_of<
+ inner_value_traits::tag::nested_parameter
+ > : empty{};
+
+ template<>
+ template<template<typename> class W,typename T>
+ struct inner_value_of<tag::nested_parameter>
+ ::apply< W<T> >{ typedef T type; };
+
+ // Specialize further as needed
+ }// meta
+
+ template<typename T>
+ struct inner_value_of
+ : meta::inner_value_of<
+ typename inner_value_traits::tag_of<T>::type>::template apply<T>{};
+
+}// inner_value_traits
+
+}// detail
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/conversion_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/conversion_traits.hpp 2010-03-13 21:48:45 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,37 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::reference_wrapper::conversion_traits.hpp //
+// //
+// (C) Copyright 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_DETAIL_REFERENCE_WRAPPER_CONVERSION_TRAITS_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_REFERENCE_WRAPPER_CONVERSION_TRAITS_ER_2010_HPP
+#include <boost/assign/auto_size/reference_wrapper/inner_value_traits.hpp>
+#include <boost/assign/auto_size/chain/conversion_traits.hpp>
+
+namespace boost{
+namespace assign{
+namespace detail{
+
+// fwd declare
+template<typename T> struct assign_reference_copy;
+template<typename T> struct assign_reference_rebind;
+
+namespace conversion_traits{
+
+ template<typename T>
+ struct tag_of< detail::assign_reference_copy<T> >
+ : tag::reference_to_inner_value{};
+
+ template<typename T>
+ struct tag_of< detail::assign_reference_rebind<T> >
+ : tag::reference_to_inner_value{};
+
+}// conversion_traits
+}// detail
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/inner_value_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/inner_value_traits.hpp 2010-03-13 21:48:45 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,36 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::reference_wrapper::inner_value_traits.hpp //
+// //
+// (C) Copyright 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_DETAIL_REFERENCE_WRAPPER_INNER_VALUE_TRAITS_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_REFERENCE_WRAPPER_INNER_VALUE_TRAITS_ER_2010_HPP
+#include <boost/assign/auto_size/chain/inner_value_traits.hpp>
+
+namespace boost{
+namespace assign{
+namespace detail{
+
+// fwd declare
+template<typename T> struct assign_reference_copy;
+template<typename T> struct assign_reference_rebind;
+
+namespace inner_value_traits{
+
+ template<typename T>
+ struct tag_of< detail::assign_reference_copy<T> >
+ : tag::nested_parameter{};
+
+ template<typename T>
+ struct tag_of< detail::assign_reference_rebind<T> >
+ : tag::nested_parameter{};
+
+}// inner_value_traits
+}// detail
+}// 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