|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60588 - sandbox/statistics/detail/assign/boost/assign/auto_size/chain
From: erwann.rogard_at_[hidden]
Date: 2010-03-14 18:02:58
Author: e_r
Date: 2010-03-14 18:02:57 EDT (Sun, 14 Mar 2010)
New Revision: 60588
URL: http://svn.boost.org/trac/boost/changeset/60588
Log:
m
Added:
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/chain_convert.hpp (contents, props changed)
Removed:
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/auto_convert.hpp
Deleted: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/auto_convert.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain/auto_convert.hpp 2010-03-14 18:02:57 EDT (Sun, 14 Mar 2010)
+++ (empty file)
@@ -1,109 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// assign::chain_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_CHAIN_AUTO_CONVERT_ER_2010_HPP
-#define BOOST_ASSIGN_DETAIL_CHAIN_AUTO_CONVERT_ER_2010_HPP
-#include <boost/typeof/typeof.hpp>
-#include <boost/range.hpp>
-#include <boost/range/chain.hpp>
-#include <boost/assign/auto_size/chain/pair_range_traits.hpp>
-#include <boost/assign/auto_size/chain/converter.hpp>
-
-#include <iostream> // TODO remove
-
-// Usage:
-// boost::copy(r1,boost::begin(chain_auto_convert(r1,r2)));
-//
-// Note that this assignement cannot work with boost::chain(r1,r2)
-//
-// Requirements : if either of r1 or r1 contains reference wrappers (W) pointing
-// to some type T,
-// is_ref_wrapper<W>::value true
-// ref_wrapper_traits::meta::value_of<W>::type T
-
-namespace boost{
-namespace assign{
-namespace result_of{
-namespace chain_auto_convert{
-
- template<typename Conv,typename R1,typename R2>
- struct generic : detail::pair_range_traits::generic<Conv,R1,R2>{
- typedef detail::pair_range_traits::generic<Conv,R1,R2> super_;
- typedef typename super_::new_range1_ new_range1_;
- typedef typename super_::new_range2_ new_range2_;
- static const new_range1_& new_range1;
- static const new_range2_& new_range2;
- typedef BOOST_TYPEOF_TPL(
- boost::chain(new_range1,new_range2)
- ) type;
-
- // MSVC:
- //typedef BOOST_TYPEOF_NESTED_TYPEDEF_TPL(
- // nested,
- // boost::chain(conv_r1,conv_r2)
- //);
- //typedef typename nested::type type;
-
- static type call(R1& r1, R2& r2){
- super_::internal_check();
- typedef typename super_::caller1_ caller1_;
- typedef typename super_::caller2_ caller2_;
- return boost::chain(caller1_::call(r1),caller2_::call(r2));
- }
- };
-
- template<typename R1,typename R2>
- struct ignore_wrapper
- : chain_auto_convert::generic<detail::pair_traits::meta::ignore_wrapper,R1,R2>
- {};
-
- template<typename R1,typename R2>
- struct apply_conversion
- : chain_auto_convert::generic<detail::pair_traits::meta::apply_conversion,R1,R2>
- {};
-
-}// chain_auto_convert
-}// result_of
-
- // generic
- template<typename Conv,typename R1,typename R2>
- typename result_of::chain_auto_convert::generic<Conv,R1,R2>::type
- chain_auto_convert(R1& r1, R2& r2){
- typedef result_of::chain_auto_convert::generic<Conv,R1,R2> caller_;
- return caller_::call(r1,r2);
- }
-
- template<typename Conv,typename R1,typename R2>
- typename result_of::chain_auto_convert::generic<Conv,
- const R1,const R2>::type
- chain_auto_convert(const R1& r1, const R2& r2){
- typedef result_of::chain_auto_convert::generic<
- Conv,const R1,const R2> caller_;
- return caller_::call(r1,r2);
- }
-
- // default uses apply_conversion
- template<typename R1,typename R2>
- typename result_of::chain_auto_convert::apply_conversion<R1,R2>::type
- chain_auto_convert(R1& r1,R2& r2){
- typedef detail::pair_traits::meta::apply_conversion conv_;
- return chain_auto_convert<conv_,R1,R2>(r1,r2);
- }
-
- template<typename R1,typename R2>
- typename result_of::chain_auto_convert::apply_conversion<
- const R1,const R2>::type
- chain_auto_convert(const R1& r1,const R2& r2){
- typedef detail::pair_traits::meta::apply_conversion conv_;
- return chain_auto_convert<conv_,R1,R2>(r1,r2);
- }
-
-}// assign
-}// boost
-
-#endif
Added: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/chain_convert.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/chain_convert.hpp 2010-03-14 18:02:57 EDT (Sun, 14 Mar 2010)
@@ -0,0 +1,144 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::chain_convert_impl.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_CHAIN_CONVERT_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_CHAIN_CONVERT_ER_2010_HPP
+#include <boost/mpl/if.hpp>
+#include <boost/range.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/assign/auto_size/chain/pair_range_traits.hpp>
+#include <boost/assign/auto_size/chain/chain_convert_impl.hpp>
+
+namespace boost{
+namespace assign{
+
+// This adaptor adds a range conversion operation to that of
+// http://gist.github.com/287791
+// developed by MPG.
+
+namespace adaptor{
+
+template<typename R1,
+ typename Conv = detail::pair_traits::meta::apply_conversion>
+class chain_convert_l
+ : public boost::sub_range<R1>
+{
+
+ typedef sub_range<R1> super_;
+
+ public:
+
+ template<typename R2>
+ struct result_impl_l{
+ typedef typename result_of::chain_convert_impl<Conv,super_,R2>::type facade_;
+ typedef chain_convert_l<facade_,Conv> type;
+ };
+
+ template<typename R2>
+ struct result_impl_r{
+ typedef typename result_of::chain_convert_impl<Conv,const super_,const R2>::type facade_;
+ typedef chain_convert_l<facade_,Conv> type;
+ };
+
+ chain_convert_l(const R1 & r) : super_(r),copy(r){ }
+
+ template<typename R2>
+ typename result_impl_l<R2>::type
+ operator()(R2 & r2)const
+ {
+ typedef typename result_impl_l<R2>::type result_;
+ return result_(chain_convert_impl<Conv>(this->copy,r2));
+ }
+
+ template<typename R2>
+ typename result_impl_r<R2>::type
+ operator()(const R2 & r2)const
+ {
+ typedef typename result_impl_r<R2>::type result_;
+ return result_(chain_convert_impl<Conv>(this->copy,r2));
+ }
+
+ private:
+ mutable boost::sub_range<R1> copy;
+};
+
+}// adaptor
+
+template<typename Conv,typename R>
+adaptor::chain_convert_l<Conv,R>
+chain_convert(R & r)
+{
+ typedef adaptor::chain_convert_l<Conv,R> result_;
+ return result_(r);
+}
+
+template<typename Conv,typename R>
+adaptor::chain_convert_l<Conv,const R>
+chain_convert(const R & r)
+{
+ typedef adaptor::chain_convert_l<Conv,const R> result_;
+ return result_(r);
+}
+
+/*
+
+template<typename Conv,typename R1, typename R2>
+typename result_of::chain_convert<R2,Conv>::template apply<R1>::type
+operator|(R1 & r1, const adaptor::chain_convert<R2,Conv> & adaptor)
+{
+ return adaptor(r1);
+}
+
+template<typename Conv,typename R1, typename R2>
+typename result_of::chain_convert<R2,Conv>::template apply<const R1>::type
+operator|(const R1 & r1, const adaptor::chain_convert<R2,Conv> & adaptor)
+{
+ return adaptor(r1);
+}
+*/
+
+// default
+
+template<typename R>
+adaptor::chain_convert_l<R>
+chain_convert(R & r)
+{
+ typedef adaptor::chain_convert_l<R> result_;
+ return result_(r);
+}
+
+template<typename R>
+adaptor::chain_convert_l<const R>
+chain_convert(const R & r)
+{
+ typedef adaptor::chain_convert_l<const R> result_;
+ return result_(r);
+}
+
+/*
+template<typename R1, typename R2>
+typename result_of::chain_convert<R2>::template apply<R1>::type
+operator|(R1 & r1, const adaptor::chain_convert<R2>& adaptor)
+{
+ return adaptor(r1);
+}
+
+template<typename R1, typename R2>
+typename result_of::chain_convert<R2>::template apply<const R1>::type
+operator|(const R1 & r1, const adaptor::chain_convert<R2> & adaptor)
+{
+ return adaptor(r1);
+}
+*/
+
+}// 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