Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60594 - in sandbox/statistics/detail/assign/boost/assign: . auto_size/chain auto_size/check
From: erwann.rogard_at_[hidden]
Date: 2010-03-14 18:43:23


Author: e_r
Date: 2010-03-14 18:43:22 EDT (Sun, 14 Mar 2010)
New Revision: 60594
URL: http://svn.boost.org/trac/boost/changeset/60594

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/auto_size.hpp | 2
   sandbox/statistics/detail/assign/boost/assign/auto_size/chain/as_member.hpp | 37 +++++++++++++------
   sandbox/statistics/detail/assign/boost/assign/auto_size/chain/chain_convert.hpp | 72 ++++++++++++++++++++++++++-------------
   sandbox/statistics/detail/assign/boost/assign/auto_size/check/chain.hpp | 12 +++---
   4 files changed, 79 insertions(+), 44 deletions(-)

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size.hpp 2010-03-14 18:43:22 EDT (Sun, 14 Mar 2010)
@@ -9,7 +9,7 @@
 #ifndef BOOST_ASSIGN_AUTO_SIZE_ER_2010_HPP
 #define BOOST_ASSIGN_AUTO_SIZE_ER_2010_HPP
 
-#include <boost/assign/auto_size/chain_auto_convert.hpp>
+#include <boost/assign/auto_size/chain_convert.hpp>
 #include <boost/assign/auto_size/ref_list_of.hpp>
 #include <boost/assign/auto_size/ref_rebind_list_of.hpp>
 #include <boost/assign/auto_size/ref_csv.hpp>

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/as_member.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain/as_member.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/as_member.hpp 2010-03-14 18:43:22 EDT (Sun, 14 Mar 2010)
@@ -8,7 +8,7 @@
 //////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_ASSIGN_AUTO_SIZE_DETAIL_ARRAY_CHAINABLE_ER_2010_HPP
 #define BOOST_ASSIGN_AUTO_SIZE_DETAIL_ARRAY_CHAINABLE_ER_2010_HPP
-#include <boost/assign/auto_size/chain/auto_convert.hpp>
+#include <boost/assign/auto_size/chain/chain_convert.hpp>
 
 namespace boost{
 namespace assign{
@@ -16,25 +16,38 @@
 
     // D is a derived type
     template<typename D>
- struct chain_as_member{
+ class chain_as_member{
 
- template<typename D1,typename R>
- struct result_of_chain_auto_convert
- : assign::result_of::chain_auto_convert::apply_conversion<D1,R>{};
+ template<bool add_const>
+ struct adaptor :
+ adaptor::chain_convert<typename boost::add_const<D>::type>
 
- template<typename R>
- typename result_of_chain_auto_convert<D,R>::type
- chain_auto_convert(R& r){
- return assign::chain_auto_convert(
+
+
+ public:
+
+ template<typename R1>
+ chain_convert(R1& r1)
+
+ static D& dummy;
+
+ typedef BOOST_TYPEOF_TPL( dummy.chain,new_range2) ) type;
+
+
+ private:
+
+ adaptor::chain_convert<D>
+ chain_convert_adaptor(){
+ return assign::chain_convert(
                 static_cast<D&>(*this),
                 r
             );
         }
 
         template<typename R>
- typename result_of_chain_auto_convert<const D,const R>::type
- chain_auto_convert(const R& r)const{
- return assign::chain_auto_convert(
+ typename result_of_chain_convert<const D>::type
+ chain_convert_adaptor()const{
+ return assign::chain_convert(
                 static_cast<const D&>(*this),
                 r
             );

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/chain_convert.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain/chain_convert.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/chain_convert.hpp 2010-03-14 18:43:22 EDT (Sun, 14 Mar 2010)
@@ -18,49 +18,70 @@
 namespace boost{
 namespace assign{
 
-// This adaptor adds a range conversion operation to that of
+// Adds range conversion (needed for assignment in the presence of reference
+// wrappers) and support for lvalue to the range adaptor here :
 // 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
+class chain_convert
     : public boost::sub_range<R1>
 {
 
     typedef sub_range<R1> super_;
 
+ template<typename R,bool add_const>
+ struct qual : boost::mpl::if_c<add_const,
+ typename boost::add_const<R>::type,
+ R
+ >{};
+
+ template<typename X1,typename X2>
+ struct result_impl_generic{
+ typedef typename result_of::chain_convert_impl<Conv,X1,X2>::type
+ facade_;
+ typedef chain_convert<facade_,Conv> type;
+ };
+
     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;
- };
+ // This is more helpful than result<F(R&)> so keep it public.
+ template<typename R2,bool add_const>
+ struct result_impl : result_impl_generic<
+ typename qual<D,add_const>::type,
+ typename qual<R2,add_const>::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;
- };
+ template<typename S>
+ struct result{};
+
+ template<typename F,typename R2>
+ struct result<F(R2&)> : result_impl<R2,false>{};
+
+ template<typename F,typename R2>
+ struct result<F(const R2&)> : result_impl<R2,true>{};
 
- chain_convert_l(const R1 & r) : super_(r),copy(r){ }
+ chain_convert(const R1 & r) : super_(r),copy(r){ }
     
     template<typename R2>
- typename result_impl_l<R2>::type
+ typename result_impl<R2,false>::type
     operator()(R2 & r2)const
     {
- typedef typename result_impl_l<R2>::type result_;
+ typedef typename result_impl<R2,false>::type result_;
         return result_(chain_convert_impl<Conv>(this->copy,r2));
     }
 
     template<typename R2>
- typename result_impl_r<R2>::type
+ typename result_impl<R2,true>::type
     operator()(const R2 & r2)const
     {
- typedef typename result_impl_r<R2>::type result_;
+ typedef typename result_impl<R2,true>::type result_;
         return result_(chain_convert_impl<Conv>(this->copy,r2));
     }
     
@@ -70,19 +91,20 @@
 
 }// adaptor
 
+
 template<typename Conv,typename R>
-adaptor::chain_convert_l<Conv,R>
+adaptor::chain_convert<Conv,R>
 chain_convert(R & r)
 {
- typedef adaptor::chain_convert_l<Conv,R> result_;
+ typedef adaptor::chain_convert<Conv,R> result_;
     return result_(r);
 }
 
 template<typename Conv,typename R>
-adaptor::chain_convert_l<Conv,const R>
+adaptor::chain_convert<Conv,const R>
 chain_convert(const R & r)
 {
- typedef adaptor::chain_convert_l<Conv,const R> result_;
+ typedef adaptor::chain_convert<Conv,const R> result_;
     return result_(r);
 }
 
@@ -106,18 +128,18 @@
 // default
 
 template<typename R>
-adaptor::chain_convert_l<R>
+adaptor::chain_convert<R>
 chain_convert(R & r)
 {
- typedef adaptor::chain_convert_l<R> result_;
+ typedef adaptor::chain_convert<R> result_;
     return result_(r);
 }
 
 template<typename R>
-adaptor::chain_convert_l<const R>
+adaptor::chain_convert<const R>
 chain_convert(const R & r)
 {
- typedef adaptor::chain_convert_l<const R> result_;
+ typedef adaptor::chain_convert<const R> result_;
     return result_(r);
 }
 

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/check/chain.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/check/chain.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/check/chain.hpp 2010-03-14 18:43:22 EDT (Sun, 14 Mar 2010)
@@ -10,7 +10,7 @@
 #define BOOST_ASSIGN_DETAIL_AUTO_SIZE_CHECK_CHAIN_ER_2010_HPP
 #include <boost/array.hpp>
 #include <boost/typeof/typeof.hpp>
-#include <boost/assign/auto_size/chain/auto_convert.hpp>
+#include <boost/assign/auto_size/chain/chain_convert.hpp>
 #include <boost/assign/auto_size/check/iterator.hpp>
 #include <boost/assign/auto_size/check/copy_iterator.hpp>
 #include <boost/assign/auto_size/reference_wrapper/conversion_traits.hpp> // MUST be included
@@ -45,11 +45,11 @@
         ar[1] = f;
         ar[2] = g;
         ar[3] = h;
- BOOST_AUTO(tmp1,coll.chain_auto_convert(ar));
- BOOST_AUTO(tmp2,coll.chain_auto_convert(coll1));
- check_iterator(tmp1,a,b,c,d,e,f,g,h);
- check_iterator(tmp2,a,b,c,d,e,f,g,h);
- check_copy_iterator(tmp1,a,b,c,d,e,f,g,h);
+// BOOST_AUTO(tmp1,coll.chain_convert(ar));
+// BOOST_AUTO(tmp2,coll.chain_convert(coll1));
+// check_iterator(tmp1,a,b,c,d,e,f,g,h);
+// check_iterator(tmp2,a,b,c,d,e,f,g,h);
+// check_copy_iterator(tmp1,a,b,c,d,e,f,g,h);
     }
 
 }// auto_size


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