$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r60566 - in sandbox/statistics/detail/assign: boost/assign/auto_size boost/assign/auto_size/chain boost/assign/auto_size/check libs/assign/example libs/assign/src
From: erwann.rogard_at_[hidden]
Date: 2010-03-13 21:30:50
Author: e_r
Date: 2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
New Revision: 60566
URL: http://svn.boost.org/trac/boost/changeset/60566
Log:
m
Removed:
   sandbox/statistics/detail/assign/boost/assign/auto_size/chain/is_reference_wrapper.hpp
Text files modified: 
   sandbox/statistics/detail/assign/boost/assign/auto_size/chain/auto_convert.hpp      |    24 ++++++------                            
   sandbox/statistics/detail/assign/boost/assign/auto_size/chain/mpl_check.hpp         |     4 --                                      
   sandbox/statistics/detail/assign/boost/assign/auto_size/chain/pair_range_traits.hpp |    20 +++-------                              
   sandbox/statistics/detail/assign/boost/assign/auto_size/chain/reference_traits.hpp  |     2 -                                       
   sandbox/statistics/detail/assign/boost/assign/auto_size/chain_auto_convert.hpp      |     1                                         
   sandbox/statistics/detail/assign/boost/assign/auto_size/check/chain.hpp             |     2                                         
   sandbox/statistics/detail/assign/boost/assign/auto_size/check/ref_list_of.hpp       |    12 +++--                                   
   sandbox/statistics/detail/assign/libs/assign/example/chain.cpp                      |    74 ++++++++++++++++++++++++++++++--------- 
   sandbox/statistics/detail/assign/libs/assign/src/main.cpp                           |     2                                         
   9 files changed, 84 insertions(+), 57 deletions(-)
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/auto_convert.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain/auto_convert.hpp	(original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/auto_convert.hpp	2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
@@ -14,6 +14,8 @@
 #include <boost/assign/auto_size/chain/pair_range_traits.hpp>
 #include <boost/assign/auto_size/chain/converter.hpp>
 
+#include <iostream> // TODO remove
+
 // Usage:
 //    chain_auto_convert(r1,r2)
 // returns a range that is formed by joining r1 and r2 whose reference is
@@ -34,8 +36,8 @@
         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 new_range1_& new_range1;
-        static 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;
@@ -51,10 +53,7 @@
             super_::internal_check();
             typedef typename super_::caller1_ caller1_;
             typedef typename super_::caller2_ caller2_;
-            new_range1_ nr1 = caller1_::call(r1);
-            new_range2_ nr2 = caller2_::call(r2);
-            return boost::chain(nr1,nr2);
-            //boost::chain(caller1_::call(r1),caller2_::call(r2)); // Not!
+            return boost::chain(caller1_::call(r1),caller2_::call(r2));
         }
     };
 
@@ -83,24 +82,25 @@
     typename result_of::chain_auto_convert::generic<Conv,
         const R1,const R2>::type
     chain_auto_convert(const R1& r1, const R2& r2){
-        return chain_auto_convert<Conv,const R1,const R2>(r1,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 result_of::chain_auto_convert::apply_conversion<R1,R2> caller_;
-        return caller_::call(r1,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 result_of::chain_auto_convert::apply_conversion<
-            const R1,const R2> caller_;
-        return caller_::call(r1,r2);
+        typedef detail::pair_traits::meta::apply_conversion conv_;
+        return chain_auto_convert<conv_,R1,R2>(r1,r2);
     }
 
 }// assign
Deleted: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/is_reference_wrapper.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain/is_reference_wrapper.hpp	2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
+++ (empty file)
@@ -1,25 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// assign::detail::is_ref_wrapper.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_IS_REFERENCE_WRAPPER_IS_ER_2010_HPP
-#define BOOST_ASSIGN_DETAIL_IS_REFERENCE_WRAPPER_IS_ER_2010_HPP
-#include <boost/mpl/bool.hpp>
-
-namespace boost{
-namespace assign{
-namespace detail{
-
-    // specialize on T
-    template<typename T>
-    struct is_ref_wrapper : boost::mpl::bool_<false>{};
-
-}// detail
-}// assign
-}// boost
-
-#endif
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/mpl_check.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain/mpl_check.hpp	(original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/mpl_check.hpp	2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
@@ -106,10 +106,6 @@
     {
         typedef pair_range_traits::helper<R1,R2> helper_;
         helper_::internal_check();
-        typedef typename helper_::convertible_to_traits traits_;
-        BOOST_MPL_ASSERT_NOT((
-           traits_::is_wrapper
-        ));
     }
 
 
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/pair_range_traits.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain/pair_range_traits.hpp	(original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/pair_range_traits.hpp	2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
@@ -11,7 +11,6 @@
 #include <boost/range.hpp>
 #include <boost/assign/auto_size/chain/pair_traits.hpp>
 #include <boost/assign/auto_size/chain/converter.hpp>
-#include <boost/assign/auto_size/chain/is_reference_wrapper.hpp>
 
 // Maps (R1,R2) to a type convertible to by either of the dereference type of
 // either of the input ranges. 
@@ -22,12 +21,15 @@
 namespace pair_range_traits{
 
     template<typename Conv,typename R1,typename R2>
-    struct generic{
+    class generic{
         typedef typename boost::range_reference<R1>::type ref1_;
         typedef typename boost::range_reference<R2>::type ref2_;
-        typedef typename 
-            Conv::template apply<ref1_,ref2_>::type convertible_to_;
+        
+        template<typename X1,typename X2>
+        struct helper : Conv::template apply<X1,X2>{};
 
+        public:
+        typedef typename helper<ref1_,ref2_>::type convertible_to_;
         typedef detail::result_of::convert_range<convertible_to_,R1> caller1_;
         typedef detail::result_of::convert_range<convertible_to_,R2> caller2_;
         
@@ -38,16 +40,6 @@
             caller1_::internal_check();
             caller1_::internal_check();
         }
-
-        struct convertible_to_traits{
-            typedef typename boost::remove_reference<convertible_to_>::type c_;
-            typedef typename boost::remove_const<c_>::type val_;
-            typedef detail::is_ref_wrapper<val_> is_wrapper;
-            
-            // Expected : (!is_wrapper::value), if Conv = apply_conversion,
-            // usually,  but not necessarilly, for ex if a ref-wrapper point to 
-            // another ref-wrapper.
-        };
         
     };
 
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/reference_traits.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain/reference_traits.hpp	(original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/reference_traits.hpp	2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
@@ -17,8 +17,6 @@
 #include <boost/type_traits/is_same.hpp>
 #include <boost/type_traits/remove_const.hpp>
 #include <boost/type_traits/remove_reference.hpp>
-//#include <boost/assign/auto_size/chain/is_reference_wrapper.hpp>
-//#include <boost/assign/auto_size/chain/reference_wrapper_traits.hpp>
 
 #include <boost/assign/auto_size/chain/conversion_traits.hpp>
 
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/chain_auto_convert.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain_auto_convert.hpp	(original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain_auto_convert.hpp	2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
@@ -10,6 +10,7 @@
 #define BOOST_ASSIGN_AUTO_CHAIN_AUTO_CONVERT_ER_2010_HPP
 
 #include <boost/assign/auto_size/chain/auto_convert.hpp> 
+#include <boost/assign/auto_size/chain/generalized_auto_convert.hpp> 
 #include <boost/assign/auto_size/reference_wrapper/conversion_traits.hpp> 
 
 #endif
\ No newline at end of file
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-13 21:30:49 EST (Sat, 13 Mar 2010)
@@ -13,7 +13,7 @@
 #include <boost/assign/auto_size/chain/auto_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/chain_traits.hpp> // MUST be included
+#include <boost/assign/auto_size/reference_wrapper/conversion_traits.hpp> // MUST be included
 
 #ifndef BOOST_ASSIGN_CHECK_EQUAL
 #error
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/check/ref_list_of.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/check/ref_list_of.hpp	(original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/check/ref_list_of.hpp	2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
@@ -26,6 +26,7 @@
 #include <boost/assign/auto_size/check/iterator.hpp>
 #include <boost/assign/auto_size/check/lifo.hpp>
 #include <boost/assign/auto_size/check/rebind_array.hpp>
+#include <boost/assign/auto_size/chain/mpl_check.hpp>
 #include <boost/assign/auto_size/check/chain.hpp>
 
 // Until range_ex avail.
@@ -47,7 +48,7 @@
             g1 = 0, h1 = 7;
 
     {
-        // ---- Examples in the documentation
+        // ---- Example in the documentation
         val_ a=a1, b=b1, c=c1, d=d1, e=e1, f=f1, g=g1, h=h1;
             val_& max = *max_element( ref_list_of(a)(b)(c)(d)(e)(f)(g)(h) );
             BOOST_ASSIGN_CHECK_EQUAL( max , f );
@@ -133,13 +134,14 @@
            ref_list_of(a1)(b1)(c1)(d1)(e1)(f1)(g1)(h1),
            a1,b1,c1,d1,e1,f1,g1,h1);
     }
+    boost::assign::detail::chain_mpl_check::compound();
     {	
         val_ a, b, c, d, e, f, g, h;
         BOOST_AUTO(tmp1,ref_list_of(a)(b)(c)(d));
-        //check_chain(
-        //   tmp1,
-        //   cref_list_of(e)(f)(g)(h),
-        //   a,b,c,d,e,f,g,h);
+        check_chain(
+           tmp1,
+           cref_list_of(e)(f)(g)(h),
+           a,b,c,d,e,f,g,h);
     }
 
     // TODO comparison operators
Modified: sandbox/statistics/detail/assign/libs/assign/example/chain.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/example/chain.cpp	(original)
+++ sandbox/statistics/detail/assign/libs/assign/example/chain.cpp	2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
@@ -11,9 +11,8 @@
 #include <boost/next_prior.hpp>
 #include <boost/range/algorithm/copy.hpp>
 #include <boost/assign/auto_size/ref_list_of.hpp>
-#include <boost/assign/auto_size/chain/add_const.hpp>
 #include <boost/assign/auto_size/chain_auto_convert.hpp>
-#include <boost/assign/auto_size/chain/mpl_check.hpp>
+#include <boost/assign/auto_size/chain/mpg.hpp>
 #include <libs/assign/example/chain.h>
 
 void example_chain(std::ostream& os)
@@ -23,28 +22,67 @@
  
     using namespace boost::assign;
     using namespace boost::assign::detail;
-	os << "-> test_chain: " << std::endl;
+	os << "-> example_chain: " << std::endl;
     typedef int val_;
-	val_ a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9 ;
+	const val_ a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9 ;
     typedef boost::array<val_,3> ar_;
     typedef std::vector<val_> vec_;
-    ar_ ar; ar.assign( -1 );
+    ar_ ar1; ar1.assign( -1 );
+    ar_ ar2; ar2.assign( 0 );
+    ar_ ar3; ar3.assign( 1 );
+    ar_ ar4; ar4.assign( 2 );
         BOOST_AUTO(tmp1,ref_list_of(a)(b)(c)(d)); 
         BOOST_AUTO(tmp2,cref_list_of(e)(f)(g)(h)); 
-        
-    os << *boost::begin(ref_list_of(e)(f)(g)(h).chain_auto_convert(cref_list_of(e)(f)(g)(h))) << std::endl;
+       
+    const int shift = 0;
+
+    // os << boost::mpg::chain(tmp1)(ar2);
+
+    boost::copy(
+         chain_auto_convert(
+            ref_list_of(a)(b)(c)(d),
+            chain_auto_convert(
+               cref_list_of(e)(f)(g)(h),
+               ar1
+            )
+        ),
+        std::ostream_iterator<val_>(os," ")
+    ); 
+    os << "nested - rvalues : OK" << std::endl;
+
+    boost::copy(
+         chain_auto_convert(
+            tmp1,
+            chain_auto_convert(
+               tmp2,
+               ar1
+            )
+        ),
+        std::ostream_iterator<val_>(os," ")
+    ); 
+    os << "nested - lvalues : OK" << std::endl;
+
+    //boost::copy(
+    //    chain_auto_convert(
+    //        ref_list_of(a)(b)(c)(d)
+    //        ,cref_list_of(e)(f)(g)(h)
+    //        ,ar1
+    //    ),
+    //    std::ostream_iterator<val_>(os," ")
+    //); // EXC_BAD_ACCESS
+    os << "flattened - rvalues : EXC_BAD_ACCESS" << std::endl;
+    
+    boost::copy(
+        chain_auto_convert(
+            tmp1
+            ,tmp2
+            ,ar1
+        ),
+        std::ostream_iterator<val_>(os," ")
+    );
+    os << "flattened - lvalues : OK" << std::endl;
+
 
-    //    //detail::add_const(tmp1).chain_auto_convert(tmp2)); 
-/*        
-    os << *boost::next(boost::begin(tmp3),0) << std::endl;// EXC_BAD_ACCESS if add_const 
-    os << *boost::next(boost::begin(tmp3),1) << std::endl;
-    os << *boost::next(boost::begin(tmp3),2) << std::endl;
-    os << *boost::next(boost::begin(tmp3),3) << std::endl;
-    os << *boost::next(boost::begin(tmp3),4) << std::endl;
-    os << *boost::next(boost::begin(tmp3),5) << std::endl;
-    os << *boost::next(boost::begin(tmp3),6) << std::endl;
-    os << *boost::next(boost::begin(tmp3),7) << std::endl;
-*/    
         os << "<- " << std::endl;
     
 }
Modified: sandbox/statistics/detail/assign/libs/assign/src/main.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/src/main.cpp	(original)
+++ sandbox/statistics/detail/assign/libs/assign/src/main.cpp	2010-03-13 21:30:49 EST (Sat, 13 Mar 2010)
@@ -7,7 +7,7 @@
 
 int main (int argc, char * const argv[]) {
 
-    //boost::assign::detail::auto_size::check_ref_list_of<int>();
+    boost::assign::detail::auto_size::check_ref_list_of<int>();
     std::cout << "check_ref_list_of : ok" << std::endl;
     //boost::assign::detail::auto_size::check_ref_csv<int>();
     //std::cout << "check_ref_csv : ok" << std::endl;