Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60528 - in sandbox/statistics/detail/assign: boost/assign/auto_size/array boost/assign/auto_size/check boost/assign/auto_size/reference_wrapper boost/assign/chain libs/assign/doc libs/assign/example libs/assign/src
From: erwann.rogard_at_[hidden]
Date: 2010-03-12 19:52:51


Author: e_r
Date: 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
New Revision: 60528
URL: http://svn.boost.org/trac/boost/changeset/60528

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/auto_size/array/interface.hpp | 4 +-
   sandbox/statistics/detail/assign/boost/assign/auto_size/check/ref_csv.hpp | 1
   sandbox/statistics/detail/assign/boost/assign/auto_size/check/ref_list_of.hpp | 12 ++++++
   sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/copy.hpp | 10 ++--
   sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/rebind.hpp | 8 ++--
   sandbox/statistics/detail/assign/boost/assign/chain/add_const.hpp | 2
   sandbox/statistics/detail/assign/boost/assign/chain/auto_convert.hpp | 70 +++++++++++++++++++++------------------
   sandbox/statistics/detail/assign/boost/assign/chain/converter.hpp | 19 +++++++---
   sandbox/statistics/detail/assign/boost/assign/chain/is_reference_wrapper.hpp | 4 +-
   sandbox/statistics/detail/assign/boost/assign/chain/pair_traits.hpp | 45 ++++++++++++++++++-------
   sandbox/statistics/detail/assign/boost/assign/chain/reference_traits.hpp | 70 +--------------------------------------
   sandbox/statistics/detail/assign/boost/assign/chain/reference_wrapper_traits.hpp | 13 ++++--
   sandbox/statistics/detail/assign/libs/assign/doc/index.html | 25 +++++++++++++
   sandbox/statistics/detail/assign/libs/assign/example/chain.cpp | 34 ++++++++++++------
   sandbox/statistics/detail/assign/libs/assign/src/main.cpp | 4 +-
   15 files changed, 168 insertions(+), 153 deletions(-)

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/array/interface.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/array/interface.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/array/interface.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -15,7 +15,7 @@
 #include <boost/assign/list_of.hpp> // for assign_detail::converter
 #include <boost/assign/auto_size/reference_wrapper/has_copy_semantics.hpp>
 #include <boost/assign/auto_size/array/ref.hpp>
-//#include <boost/assign/auto_size/array/chainable.hpp>
+#include <boost/assign/auto_size/array/chainable.hpp>
 
 namespace boost{
 namespace assign{
@@ -52,7 +52,7 @@
             array_interface<T,N,R,D>,
         typename array_interface_traits<T,N,R>::const_iterator
>
- //,public auto_size::chainable<array_interface<T,N,R,D> >
+ ,public auto_size::chainable<array_interface<T,N,R,D> >
     {
         typedef array_interface_traits<T,N,R> traits;
         typedef typename traits::ref_ ref_;

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/check/ref_csv.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/check/ref_csv.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/check/ref_csv.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -133,6 +133,7 @@
            a1,b1,c1,d1,e1,f1,g1,h1);
     }
 
+ // TODO add check_chain
 }
 
 

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-12 19:52:49 EST (Fri, 12 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/check/chain.hpp>
 
 // Until range_ex avail.
 #include <boost/assign/auto_size/check/max_element.hpp>
@@ -133,6 +134,17 @@
            a1,b1,c1,d1,e1,f1,g1,h1);
     }
 
+ {
+ val_ a, b, c, d, e, f, g, h;
+ BOOST_AUTO(tmp1,ref_list_of(a)(b)(c)(d));
+ BOOST_AUTO(tmp2,cref_list_of(e)(f)(g)(h)); // For now (rvalue otherwise)
+ check_chain(
+ tmp1,
+ tmp2,
+ a,b,c,d,e,f,g,h);
+ }
+
+
 }
 
 

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/copy.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/copy.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/copy.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -30,27 +30,27 @@
 
         void operator=( const T& r )
         {
- *ref_ = r;
+ *this->ref_ = r;
         }
 
         operator T&() const
         {
- return *ref_;
+ return *this->ref_;
         }
 
         void swap( assign_reference_copy& r )
         {
- std::swap( *ref_, *r.ref_ );
+ std::swap( *this->ref_, *r.ref_ );
         }
 
         T& get_ref() const
         {
- return *ref_;
+ return *this->ref_;
         }
 
         void rebind( T & r )
             {
- ref_ = &r;
+ this->ref_ = &r;
             }
         
     private:

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/rebind.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/rebind.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/rebind.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -26,24 +26,24 @@
 
         void operator=( T& r )
         {
- ref_ = &r;
+ this->ref_ = &r;
         }
 
         operator T&() const
         {
- return *ref_;
+ return *this->ref_;
         }
 
         void swap( assign_reference_rebind& r )
         {
             T* tmp = this->ref_;
- ref_ = r.ref_;
+ this->ref_ = r.ref_;
             r.ref_ = tmp;
         }
 
         T& get_ref() const
         {
- return *ref_;
+ return *this->ref_;
         }
         
     private:

Modified: sandbox/statistics/detail/assign/boost/assign/chain/add_const.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/chain/add_const.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/chain/add_const.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -8,7 +8,7 @@
 //////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_ASSIGN_DETAIL_AUTO_SIZE_CHAIN_ADD_CONST_ER_2010_HPP
 #define BOOST_ASSIGN_DETAIL_AUTO_SIZE_CHAIN_ADD_CONST_ER_2010_HPP
-#include <boost/type_traits.hpp>
+#include <boost/type_traits/add_const.hpp>
 
 namespace boost{
 namespace assign{

Modified: sandbox/statistics/detail/assign/boost/assign/chain/auto_convert.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/chain/auto_convert.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/chain/auto_convert.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -1,5 +1,5 @@
 //////////////////////////////////////////////////////////////////////////////
-// assign::detail::chain_auto_convert.hpp //
+// assign::chain_auto_convert.hpp //
 // //
 // (C) Copyright 2010 Erwann Rogard //
 // Use, modification and distribution are subject to the //
@@ -11,59 +11,66 @@
 #include <boost/typeof/typeof.hpp>
 #include <boost/range.hpp>
 #include <boost/range/chain.hpp>
-#include <boost/assign/chain/pair_traits.hpp>
+#include <boost/assign/chain/pair_range_traits.hpp>
 #include <boost/assign/chain/converter.hpp>
 
-// See note in auto_size::expr for rationable behind this class
+// Usage:
+// chain_auto_convert(r1,r2)
+// returns a range that is formed by joining r1 and r2 whose reference is
+// convertible from either of those of r1 and r2.
+//
+// Requirements : if either of r1 or r1 contains reference wrappers (W) pointing
+// to some type T,
+// is_ref_wrapper<W>::type boolean constant
+// ref_wrapper_traits::meta::value_of<W>::type class
+// Bugs:
+// const ranges cause BAD_EXC_ACCESS
 
 namespace boost{
 namespace assign{
-namespace detail{
 namespace result_of{
 namespace chain_auto_convert{
     
     template<typename Conv,typename R1,typename R2>
- struct generic{
- typedef typename boost::range_reference<R1>::type r1_;
- typedef typename boost::range_reference<R2>::type r2_;
- typedef typename Conv::template apply<r1_,r2_>::type to_;
- typedef result_of::convert_range<to_,R1> caller1_;
- typedef result_of::convert_range<to_,R2> caller2_;
- typedef typename caller1_::type conv_r1_;
- typedef typename caller2_::type conv_r2_;
- static conv_r1_& conv_r1;
- static conv_r2_& conv_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 new_range1_& new_range1;
+ static new_range2_& new_range2;
         typedef BOOST_TYPEOF_TPL(
                 boost::chain(
- conv_r1,
- conv_r2
+ new_range1,
+ new_range2
                 )
         ) type;
 
         // MSVC:
         //typedef BOOST_TYPEOF_NESTED_TYPEDEF_TPL(
         // nested,
- // boost::chain(conv1,conv22)
+ // boost::chain(conv_r1,conv_r2)
         //);
         //typedef typename nested::type type;
 
- typedef detail::functional::converter<to_> converter_;
         static type call(R1& r1, R2& r2){
- conv_r1_ conv_r1 = caller1_::call(r1);
- conv_r2_ conv_r2 = caller2_::call(r2);
- return boost::chain(conv_r1,conv_r2);
- // boost::chain(caller1_::call(r1),caller2_::call(r2)); // Not!
+ 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!
         }
     };
 
     template<typename R1,typename R2>
     struct ignore_wrapper
- : chain_auto_convert::generic<pair_traits::meta::ignore_wrapper,R1,R2>
+ : chain_auto_convert::generic<detail::pair_traits::meta::ignore_wrapper,R1,R2>
         {};
 
     template<typename R1,typename R2>
- struct filter_wrapper
- : chain_auto_convert::generic<pair_traits::meta::filter_wrapper,R1,R2>
+ struct convert_wrapper
+ : chain_auto_convert::generic<detail::pair_traits::meta::convert_wrapper,R1,R2>
         {};
 
 }// chain_auto_convert
@@ -85,23 +92,22 @@
         return g_::call(r1,r2);
     }
 
- // filter_wrapper
+ // convert_wrapper
     template<typename R1,typename R2>
- typename result_of::chain_auto_convert::filter_wrapper<R1,R2>::type
- chain_auto_convert_filter_wrapper(R1& r1,R2& r2){
- typedef result_of::chain_auto_convert::filter_wrapper<R1,R2> g_;
+ typename result_of::chain_auto_convert::convert_wrapper<R1,R2>::type
+ chain_auto_convert_convert_wrapper(R1& r1,R2& r2){
+ typedef result_of::chain_auto_convert::convert_wrapper<R1,R2> g_;
         return g_::call(r1,r2);
     }
 
     // default
     template<typename R1,typename R2>
- typename result_of::chain_auto_convert::filter_wrapper<R1,R2>::type
+ typename result_of::chain_auto_convert::convert_wrapper<R1,R2>::type
     chain_auto_convert(R1& r1,R2& r2){
- typedef result_of::chain_auto_convert::filter_wrapper<R1,R2> g_;
+ typedef result_of::chain_auto_convert::convert_wrapper<R1,R2> g_;
         return g_::call(r1,r2);
     }
 
-}// detail
 }// assign
 }// boost
 

Modified: sandbox/statistics/detail/assign/boost/assign/chain/converter.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/chain/converter.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/chain/converter.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -11,8 +11,12 @@
 #include <boost/mpl/assert.hpp>
 #include <boost/range.hpp>
 #include <boost/range/adaptor/transformed.hpp>
+#include <boost/type_traits/is_same.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 
+// Usage:
+// convert_range<T>(r)
+
 namespace boost{
 namespace assign{
 namespace detail{
@@ -41,21 +45,24 @@
         typename U = typename boost::range_reference<Rng>::type>
     struct convert_range
     {
-
- BOOST_MPL_ASSERT((
- boost::is_convertible<U,T>
- ));
                 typedef functional::converter<T> adaptor_;
         typedef boost::transform_range<adaptor_,Rng> type;
+
+ static void internal_check(){
+ BOOST_MPL_ASSERT((boost::is_convertible<U,T>));
+ typedef boost::transform_range<adaptor_,Rng> new_range_;
+ typedef typename boost::range_reference<new_range_>::type new_ref_;
+ BOOST_MPL_ASSERT((boost::is_same<new_ref_,T>));
+ }
         static type call(Rng& r){
+ internal_check();
                 return type(adaptor_(),r);
         }
     };
     
 }
 
- // This seems to take care of const Rng. Overloads with const Rng have
- // compile deficiencies. TODO verify this.
+ // Takes care of const Rng, I think.
 
     template<typename T,typename Rng>
     typename detail::result_of::convert_range<T,Rng>::type

Modified: sandbox/statistics/detail/assign/boost/assign/chain/is_reference_wrapper.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/chain/is_reference_wrapper.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/chain/is_reference_wrapper.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -6,8 +6,8 @@
 // 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_IS_REFERENCE_WRAPPER_IS_ER_2010_HPP
-#define BOOST_ASSIGN_DETAIL_CHAIN_IS_REFERENCE_WRAPPER_IS_ER_2010_HPP
+#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{

Modified: sandbox/statistics/detail/assign/boost/assign/chain/pair_traits.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/chain/pair_traits.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/chain/pair_traits.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -1,13 +1,13 @@
 //////////////////////////////////////////////////////////////////////////////
-// assign::detail::pair_auto_convert.hpp //
+// assign::detail::pair_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_PAIR_AUTO_CONVERT_ER_2010_HPP
-#define BOOST_ASSIGN_DETAIL_PAIR_AUTO_CONVERT_ER_2010_HPP
+#ifndef BOOST_ASSIGN_DETAIL_PAIR_TRAITS_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_PAIR_TRAITS_ER_2010_HPP
 #include <utility>
 #include <boost/mpl/and.hpp>
 #include <boost/mpl/assert.hpp>
@@ -19,8 +19,9 @@
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/assign/chain/reference_traits.hpp>
 
-// The purpose of these traits is, given T and U, to find V such that
-// V v1 = t; V v2 = u;
+// These traits maps T and U, each of which may identify a reference wrapper,
+// to V such that
+// V v1 = t; V v2 = u;
 // is a valid expression. U and T may be references or reference wrappers
 
 namespace boost{
@@ -28,6 +29,16 @@
 namespace detail{
 namespace pair_traits{
 
+ template<typename D>
+ struct add_check_symmetry{
+ static void check_symmetry()
+ {
+ typedef typename D::type type;
+ typedef typename D::symmetric::type sym_type;
+ BOOST_MPL_ASSERT((boost::is_same<type,sym_type>));
+ }
+ };
+
     template<typename T,typename U>
     struct use_const : boost::mpl::or_<
         typename reference_traits::is_const<T>::type,
@@ -41,7 +52,7 @@
>{};
     
     template<typename T,typename U>
- struct filter_ref_const{
+ struct filter_ref_const : add_check_symmetry< filter_ref_const<T,U> >{
         typedef typename pair_traits::use_reference<T,U>::type use_ref_;
         typedef typename pair_traits::use_const<T,U>::type use_const_;
         template<typename F,typename S>
@@ -56,10 +67,12 @@
         typedef typename local<T>::type first_;
         typedef typename local<U>::type second_;
         typedef pair<first_,second_> type;
+
+ struct symmetric : filter_ref_const<U,T>{};
     };
 
     template<typename T,typename U>
- struct ignore_wrapper
+ struct ignore_wrapper : add_check_symmetry< ignore_wrapper<T,U> >
     {
         typedef typename pair_traits::filter_ref_const<T,U>::type traits_;
         typedef typename traits_::first_type first_;
@@ -68,14 +81,20 @@
             typename boost::is_convertible<first_,second_>::type use_second_;
         typedef typename
             boost::mpl::if_c<use_second_::value,second_,first_>::type type;
- BOOST_MPL_ASSERT((boost::is_convertible<first_,type>));
- BOOST_MPL_ASSERT((boost::is_convertible<second_,type>));
+
+ struct symmetric : ignore_wrapper<U,T>{};
+ static void internal_check(){
+ typedef add_check_symmetry< ignore_wrapper<T,U> > super_;
+ super_::check_symmetry();
+ BOOST_MPL_ASSERT((boost::is_convertible<first_,type>));
+ BOOST_MPL_ASSERT((boost::is_convertible<second_,type>));
+ }
     };
     
     template<typename T,typename U>
- struct filter_wrapper : pair_traits::ignore_wrapper<
- typename reference_traits::filter_wrapper<T>::type,
- typename reference_traits::filter_wrapper<U>::type
+ struct convert_wrapper : pair_traits::ignore_wrapper<
+ typename reference_traits::convert_wrapper<T>::type,
+ typename reference_traits::convert_wrapper<U>::type
>{};
 
     namespace meta{
@@ -86,7 +105,7 @@
             struct apply : M<T,U>{};
         };
         struct ignore_wrapper : meta::helper<pair_traits::ignore_wrapper>{};
- struct filter_wrapper : meta::helper<pair_traits::filter_wrapper>{};
+ struct convert_wrapper : meta::helper<pair_traits::convert_wrapper>{};
     }
 
 }// pair_traits

Modified: sandbox/statistics/detail/assign/boost/assign/chain/reference_traits.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/chain/reference_traits.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/chain/reference_traits.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -19,7 +19,7 @@
 #include <boost/assign/chain/is_reference_wrapper.hpp>
 #include <boost/assign/chain/reference_wrapper_traits.hpp>
 
-// Maps U to a convertible type where U can be a reference_wrapper or a ref.
+// Map T, a reference or a reference_wrapper, to a convertible type.
 
 namespace boost{
 namespace assign{
@@ -52,7 +52,7 @@
     };
 
     template<typename T>
- struct filter_wrapper{
+ struct convert_wrapper{
         typedef typename reference_traits::remove_cref<T>::type value_;
         typedef typename detail::is_ref_wrapper<value_>::type is_rw_;
         typedef typename boost::mpl::eval_if_c<
@@ -62,72 +62,6 @@
>::type type;
     };
 
-namespace pair{
-
- template<typename T,typename U>
- struct use_const : boost::mpl::or_<
- typename reference_traits::is_const<T>::type,
- typename reference_traits::is_const<U>::type
- >{};
-
- template<typename T,typename U>
- struct use_reference : boost::mpl::and_<
- typename boost::is_reference<T>::type,
- typename boost::is_reference<U>::type
- >{};
-
- template<typename T,typename U>
- struct filter_ref_const{
- typedef typename pair::use_reference<T,U>::type use_ref_;
- typedef typename pair::use_const<T,U>::type use_const_;
- template<typename V>
- struct local
- : reference_traits::filter_ref_const<
- use_ref_::value,use_const_::value,V>{};
- typedef typename local<T>::type first_;
- typedef typename local<U>::type second_;
- typedef std::pair<first_,second_> type;
- };
-}// pair
-namespace convertible_to{
-
- template<typename T,typename U>
- struct ignore_wrapper
- {
- typedef typename pair::filter_ref_const<T,U>::type pair_;
- typedef typename pair_::first first_;
- typedef typename pair_::second second_;
- typedef typename boost::is_convertible<
- first_, // from
- second_ // to
- >::type use_second_;
- typedef typename boost::mpl::if_c<
- use_second_::value,
- second_,
- first_
- >::type type;
- BOOST_MPL_ASSERT((boost::is_convertible<first_,type>));
- BOOST_MPL_ASSERT((boost::is_convertible<second_,type>));
- };
-
- template<typename T,typename U>
- struct filter_wrapper : convertible_to::ignore_wrapper<
- typename reference_traits::filter_wrapper<T>::type,
- typename reference_traits::filter_wrapper<U>::type
- >{};
-
- namespace meta{
-
- template<template<typename,typename> class M>
- struct helper{
- template<typename T,typename U>
- struct apply : boost::mpl::identity< M<T,U> >{};
- };
- struct ignore_wrapper : meta::helper<convertible_to::ignore_wrapper>{};
- struct filter_wrapper : meta::helper<convertible_to::filter_wrapper>{};
- }
-
-}// convertible_to
 }// reference_traits
 }// detail
 }// assign

Modified: sandbox/statistics/detail/assign/boost/assign/chain/reference_wrapper_traits.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/chain/reference_wrapper_traits.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/chain/reference_wrapper_traits.hpp 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -30,20 +30,23 @@
         ::template apply<T>{};
 
     namespace meta{
+ // specialize on Tag
         template<typename Tag>
         struct value_of{
- // define template<typename T> struct apply;
+ // template<typename T> struct apply;
         };
 
- template<typename T> struct default_value_of{};
- template<typename T,template<typename> class W>
- struct default_value_of<W<T> >{ typedef T type; };
+ namespace impl{
+ template<typename T> struct value_of{};
+ template<typename T,template<typename> class W>
+ struct value_of<W<T> >{ typedef T type; };
+ }
         
         template<>
         struct value_of<ref_wrapper_traits::tag::default_>
         {
             template<typename T>
- struct apply : default_value_of<T>{};
+ struct apply : impl::value_of<T>{};
         };
     }
 

Modified: sandbox/statistics/detail/assign/libs/assign/doc/index.html
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/doc/index.html (original)
+++ sandbox/statistics/detail/assign/libs/assign/doc/index.html 2010-03-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -38,6 +38,7 @@
             <li>Function map_list_of()
             <li>Function tuple_list_of()
             <li>Functions repeat(), repeat_fun() and range()
+ <li>Functions chain_auto_convert()
             <li>Functions ref_list_of(), cref_list_of() and variants
             <li>Functions ref_csv(), cref_csv() and variants
             <li>A "complicated" example
@@ -63,6 +64,7 @@
         <li>Functions repeat(), repeat_fun() and
                                                                       <a href="#ref-repeat_ref"><code>range()</code>
                                                                       </a></li>
+ <li>Functions chain_auto_convert()</li>
         <li>Customizing argument list sizes </li>
      </ul>
     <li>
@@ -442,7 +444,7 @@
 If you just need to insert an iterator-range somewhere in the list, the member function <code>range()</code> provides just what you want.
 It is based on Boost.Range, so you can pass all the ranges supported by that library. For example
 <blockquote><pre><span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>boost</span><span class=special>/</span><span class=identifier>assign</span><span class=special>/</span><span class=identifier>list_inserter</span><span class=special>.</span><span class=identifier>hpp</span><span class=special>&gt;</span> <span class=comment>// for 'push_back()'</span>
-<span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>boost</span><span class=special>/</span><span class=identifier>assign</span><span class=special>/</span><span class=identifier>list_of</span><span class=special>.</span><span class=identifier>hpp</span><span class=special>&gt;</span> <span class=comment>// for 'list_of()' and 'ref_list_of()'</span>
+<span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>boost</span><span class=special>/</span><span class=identifier>assign</span><span class=special>/</span><span class=identifier>list_of</span><span class=special>.</span><span class=identifier>hpp</span><span class=special>&gt;</span> <span class=comment>// for 'list_of()' and 'ref_list_of&lt;int&gt;()'</span>
 <span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>boost</span><span class=special>/</span><span class=identifier>assert</span><span class=special>.</span><span class=identifier>hpp</span><span class=special>&gt;</span>
 
 <span class=keyword>using</span> <span class=keyword>namespace</span> <span class=identifier>std</span><span class=special>;</span>
@@ -472,6 +474,27 @@
 
 </p>
 
+<h3>Function <code>chain_auto_convert()</code> <a name="chain_auto_convert"></h3>
+
+While the function range() works in combination with functions
+such as list_of(), it is not compatible with
+ref_csv(), ref_list_of() and their variants,
+which are part of a different framework. The function <code>chain_auto_convert()</code>,
+however, achieves a similar goal. Continuing the example above,
+
+
+<blockquote><pre><span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>boost</span><span class=special>/</span><span class=identifier>assign</span><span class=special>/</span><span class=identifier>auto_size</span><span class=special>/</span><span class=identifier>chain_auto_convert</span><span class=special>.</span><span class=identifier>hpp</span><span class=special>&gt;</span>
+<span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>boost</span><span class=special>/</span><span class=identifier>assign</span><span class=special>/</span><span class=identifier>auto_size</span><span class=special>/</span><span class=identifier>ref_list_of</span><span class=special>.</span><span class=identifier>hpp</span><span class=special>&gt;</span>
+
+<span class=special>{</span>
+ <span class=identifier>BOOST_AUTO</span><span class=special>( </span><span class=identifier>t1</span><span class=special>, </span><span class=identifier>ref_list_of</span>(</span><span class=identifier>x</span><span class=special>).</span><span class=identifier>chain_auto_convert</span><span class=special>(</span><span class=identifier>v2</span><span class=special>)</span><span class=special> );</span>
+ <span class=identifier>BOOST_AUTO</span><span class=special>( </span><span class=identifier>t2</span><span class=special>, </span><span class=identifier>ref_list_of</span>(</span><span class=identifier>y</span><span class=special>)</span> <span class=special>)</span><span class=special>;</span>
+ <span class=identifier>BOOST_ASSERT</span><span class=special>( </span> <span class=identifier>chain_auto_convert</span><span class=special>(</span> <span class=identifier>t1</span><span class=special> , </span><span class=identifier>t2</span> <span class=special>)</span><span class=special>.</span><span class=identifier>boost::size</span><span class=special>(</span><span class=special>)</span><span class=special> == </span><span class=number>10u</span><span class=special> )</span><span class=special>;</span>
+<span class=special>}</span></pre>
+</blockquote>
+
+As of March 2010 this functionality is experimental, so caution is advised in using it.
+
 <h3>Functions <code>ref_list_of()</code>, <code>cref_list_of()</code> <a name="ref_list_of"> and variants</h3>
 
 When you need to create an anonymous range of values and speed is essential,

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-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -11,29 +11,39 @@
 #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/reference_wrapper/chain_traits.hpp> // MUST be included
-#include <boost/assign/chain/auto_convert.hpp>
+#include <boost/assign/chain/add_const.hpp>
+#include <boost/assign/auto_size/chain_auto_convert.hpp>
+#include <boost/assign/chain/mpl_check.hpp>
 #include <libs/assign/example/chain.h>
 
 void example_chain(std::ostream& os)
 {
 
+ boost::assign::detail::chain_mpl_check::compound();
+
+
     using namespace boost::assign;
     using namespace boost::assign::detail;
         os << "-> test_chain: " << std::endl;
     typedef int val_;
- val_ a = 1, b = 2, c = 3;
+ 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_;
- typedef detail::result_of::convert_range<val_&,ar_> caller_;
- typedef caller_::type res_;
- ar_ ar; ar.assign(-1);
- BOOST_AUTO(tmp1,cref_list_of(a)(b)(c));
- boost::copy(
- detail::chain_auto_convert_filter_wrapper(tmp1,ar),
- std::ostream_iterator<val_>(os," ")
- );
-
+ ar_ ar; ar.assign( -1 );
+ BOOST_AUTO(tmp1,ref_list_of(a)(b)(c)(d));
+ BOOST_AUTO(tmp2,cref_list_of(e)(f)(g)(h));
+ BOOST_AUTO(tmp3,
+ tmp1.chain_auto_convert(tmp2));
+ //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-12 19:52:49 EST (Fri, 12 Mar 2010)
@@ -7,12 +7,12 @@
 
 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;
 
- example_chain(std::cout);
+ //example_chain(std::cout);
 
     return 0;
 


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