Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60782 - in sandbox/statistics/detail/assign: boost/assign boost/assign/auto_size/array boost/assign/auto_size/check boost/assign/auto_size/range boost/assign/auto_size/traits libs/assign/doc libs/assign/example libs/assign/src
From: erwann.rogard_at_[hidden]
Date: 2010-03-22 22:47:24


Author: e_r
Date: 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
New Revision: 60782
URL: http://svn.boost.org/trac/boost/changeset/60782

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/auto_size/array/converter.hpp | 1
   sandbox/statistics/detail/assign/boost/assign/auto_size/array/interface.hpp | 12 ++++-
   sandbox/statistics/detail/assign/boost/assign/auto_size/check/all.hpp | 6 +-
   sandbox/statistics/detail/assign/boost/assign/auto_size/check/chain.hpp | 3
   sandbox/statistics/detail/assign/boost/assign/auto_size/range/chain_l.hpp | 33 +++++++--------
   sandbox/statistics/detail/assign/boost/assign/auto_size/range/convert_range.hpp | 84 ++++++++++++++++++---------------------
   sandbox/statistics/detail/assign/boost/assign/auto_size/traits/conversion_traits.hpp | 8 +-
   sandbox/statistics/detail/assign/boost/assign/auto_size/traits/inner_value_traits.hpp | 6 -
   sandbox/statistics/detail/assign/boost/assign/chain_convert.hpp | 2
   sandbox/statistics/detail/assign/libs/assign/doc/revision_history.txt | 4 +
   sandbox/statistics/detail/assign/libs/assign/example/range.cpp | 39 +++--------------
   sandbox/statistics/detail/assign/libs/assign/src/main.cpp | 8 +-
   12 files changed, 91 insertions(+), 115 deletions(-)

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/array/converter.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/array/converter.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/array/converter.hpp 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -17,6 +17,7 @@
 namespace detail{
 namespace auto_size{
 
+ // This has yet to be figured out (how to forward to a crtp class).
     template< typename T, typename I >
     class converter
        : protected boost::assign_detail::converter<auto_size::converter<T,I>,I>

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-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -41,6 +41,8 @@
 
     };
                    
+ // Warning : do not yet use comparison operatators between array_interfaces.
+
     // Used as a base class of D, adds the array and conversion interface
     //
     // Requirements: let d1 and d2 instances of D and const D, respectively
@@ -50,10 +52,14 @@
     template<typename T,std::size_t N,template<typename> class R,typename D>
     class array_interface
       : public
- auto_size::converter<
+ assign_detail::converter<
             array_interface<T,N,R,D>,
- typename array_interface_traits<T,N,R>::const_iterator
- >
+ typename array_interface_traits<T,N,R>::const_iterator
+ >
+ //auto_size::converter<
+ // array_interface<T,N,R,D>,
+ // typename array_interface_traits<T,N,R>::const_iterator
+ //>
     {
         typedef array_interface_traits<T,N,R> traits;
         typedef typename traits::ref_ ref_;

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/check/all.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/check/all.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/check/all.hpp 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -19,8 +19,8 @@
 #include <boost/assign/auto_size/check/constants.hpp>
 
 #include <boost/assign/auto_size/check/array.hpp>
-#include <boost/assign/auto_size/check/chain.hpp>
-#include <boost/assign/auto_size/check/comparison_op.hpp>
+//#include <boost/assign/auto_size/check/chain.hpp>
+//#include <boost/assign/auto_size/check/comparison_op.hpp>
 #include <boost/assign/auto_size/check/converter.hpp>
 #include <boost/assign/auto_size/check/copy_array.hpp>
 #include <boost/assign/auto_size/check/copy_iterator.hpp>
@@ -52,7 +52,6 @@
     BOOST_ASSIGN_AS_CHECK_converter_sorted(std::set<T>) \
     BOOST_ASSIGN_AS_CHECK_adapter_lifo(std::stack<T>) \
     BOOST_ASSIGN_AS_CHECK_adapter_fifo(std::queue<T>) \
- BOOST_ASSIGN_AS_CHECK_comparison_op \
 } \
 void BOOST_PP_CAT(fun,_int)(){ fun<int>(); } \
 } \
@@ -62,6 +61,7 @@
 /**/
 
 /*
+ BOOST_ASSIGN_AS_CHECK_comparison_op \
     BOOST_ASSIGN_AS_CHECK_chain \
     BOOST_ASSIGN_AS_CHECK_example2 \
 */

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-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -11,11 +11,10 @@
 #include <boost/array.hpp>
 #include <boost/typeof/typeof.hpp>
 #include <boost/range/algorithm/copy.hpp>
-#include <boost/assign/auto_size/chain/chain.hpp>
+#include <boost/assign/auto_size/range/chain_convert_l.hpp>
 #include <boost/assign/auto_size/check/iterator.hpp>
 #include <boost/assign/auto_size/check/constants.hpp>
 #include <boost/assign/auto_size/check/copy_iterator.hpp>
-#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/range/chain_l.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/range/chain_l.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/range/chain_l.hpp 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -14,24 +14,21 @@
 #include <boost/mpl/void.hpp>
 #include <boost/range.hpp>
 #include <boost/range/chain.hpp>
+#include <boost/assign/auto_size/range/result_of_chain.hpp>
 
 // This is based on
 // http://gist.github.com/287791
 // developed by MPG, but allows lvalues.
 
+// Usage : Let r1, r2 and r3 denote ranges,
+// boost::copy( from, boost::begin( chain_l(r1)(r2)(r3) ) );
+// Note: if either of r, r2 or r3 is a range of reference wrappers, then all
+// three also have to.
+
 namespace boost{
 namespace assign{
 namespace detail{
-namespace range{
-
-namespace result_of{
- template<typename R1,typename R2>
- struct chain_l{
- static R1 r1;
- static R2 r2;
- typedef BOOST_TYPEOF_TPL( boost::chain(r1,r2) ) type;
- };
-}
+namespace chain_l_impl{
 
     template<typename E,typename R1,int N>
         class expr;
@@ -42,7 +39,7 @@
     };
     
     template<typename E,typename R1,int N>
- struct super_of_expr : result_of::chain_l<E,R1>{};
+ struct super_of_expr : detail::result_of::chain<typename E::super_,R1>{};
 
     template<typename E,typename R1>
     struct super_of_expr<E,R1,1>{
@@ -67,6 +64,9 @@
         
         typedef typename super_of_expr<E,R1,N>::type super_;
     
+ super_& super(){ return (*this); }
+ const super_& super()const{ return (*this); }
+
         explicit expr(super_ s):super_(s){}
         explicit expr(E& p,super_ s):previous(p),super_(s){}
 
@@ -78,7 +78,7 @@
             return res_(
                 *this,
                 super_(
- boost::chain(*this,r2)
+ boost::chain(this->super(),r2)
                 )
             );
         }
@@ -93,18 +93,17 @@
         typedef expr<top_,R1,1> type;
         typedef typename type::super_ super_;
         static type call(R1& r1){
- return type(super_(r1));
+ return type(super_(r1));
         }
     };
     
-
-}// range
+}// chain_l_impl
 }// detail
 
     template<typename R1>
- typename detail::range::first_expr<R1>::type
+ typename detail::chain_l_impl::first_expr<R1>::type
     chain_l(R1& r1){
- typedef detail::range::first_expr<R1> caller_;
+ typedef detail::chain_l_impl::first_expr<R1> caller_;
         return caller_::call(r1);
     }
 

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/range/convert_range.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/range/convert_range.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/range/convert_range.hpp 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -11,9 +11,10 @@
 #include <boost/mpl/assert.hpp>
 #include <boost/range.hpp>
 #include <boost/range/adaptor/transformed.hpp>
+#include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/type_traits/is_convertible.hpp>
-#include <boost/assign/auto_size/conversion/iterator.hpp>
+#include <boost/assign/auto_size/range/iterator_converter.hpp>
 #include <boost/assign/auto_size/traits/reference_traits.hpp>
 
 // Usage:
@@ -25,82 +26,74 @@
 namespace boost{
 namespace assign{
 namespace detail{
-namespace adaptor{
 
-struct use_default;
-
-template<typename T = use_default>
-struct convert_range{ convert_range(){} };
-
-}// adaptor
+template<typename Rng,typename V>
+struct convert_range_reference
+ : detail::converted_iterator_reference<
+ typename boost::range_iterator<Rng>::type,
+ V
+ >{};
 
 namespace result_of{
-
- template<
- typename Rng,
- typename T = typename reference_traits::convert_to<
- typename boost::range_reference<Rng>::type
- >::type
- >
+
+ template<typename Rng,typename V,
+ typename R = typename convert_range_reference<Rng,V>::type>
     struct convert_range
     {
- typedef adaptor::convert_range<T> adaptor_;
         typedef typename boost::range_iterator<Rng>::type base_it_;
- typedef detail::iterator_converter<base_it_,T> new_it_;
+ typedef detail::converted_iterator<base_it_,V,R> new_it_;
         typedef boost::iterator_range<new_it_> type;
 
- static void internal_check(){
- typedef typename boost::range_reference<Rng>::type u_;
- BOOST_MPL_ASSERT((boost::is_convertible<u_,T>));
- typedef typename boost::range_reference<type>::type new_ref_;
- BOOST_MPL_ASSERT((boost::is_same<new_ref_,T>));
- }
         static type call(Rng& r){
- internal_check();
             return type(
- detail::convert_iterator<T>(boost::begin(r)),
- detail::convert_iterator<T>(boost::end(r))
+ convert_iterator<V,R>(boost::begin(r)),
+ convert_iterator<V,R>(boost::end(r))
             );
         }
     };
 
-}
+}// result_of
+}// detail
 
- // convert_range
+ // convert_range
 
- template<typename T,typename Rng>
- typename detail::result_of::convert_range<Rng,T>::type
- convert_range( Rng& r)
+ template<typename V,typename R,typename Rng>
+ typename detail::result_of::convert_range<Rng,V,R>::type
+ convert_range( Rng& r,
+ typename boost::disable_if<boost::is_same<R,use_default> >::type* = 0)
     {
- typedef detail::result_of::convert_range<Rng,T> caller_;
+ typedef detail::result_of::convert_range<Rng,V,R> caller_;
         return caller_::call( r );
     }
 
- template<typename T,typename Rng>
- typename detail::result_of::convert_range<const Rng,T>::type
- convert_range( const Rng& r)
+ template<typename V,typename R,typename Rng>
+ typename detail::result_of::convert_range<const Rng,V,R>::type
+ convert_range( const Rng& r,
+ typename boost::disable_if<boost::is_same<R,use_default> >::type* = 0)
     {
- typedef detail::result_of::convert_range<const Rng,T> caller_;
+ typedef detail::result_of::convert_range<const Rng,V,R> caller_;
         return caller_::call( r );
     }
 
-/*
- template<typename Rng>
- typename detail::result_of::convert_range<Rng>::type
- convert_range( Rng& r)
+ template<typename V,typename R,typename Rng>
+ typename detail::result_of::convert_range<Rng,V>::type
+ convert_range( Rng& r,
+ typename boost::enable_if<boost::is_same<R,use_default> >::type* = 0)
     {
- typedef detail::result_of::convert_range<Rng> caller_;
+ typedef detail::result_of::convert_range<Rng,V> caller_;
         return caller_::call( r );
     }
 
- template<typename Rng>
- typename detail::result_of::convert_range<const Rng>::type
- convert_range( const Rng& r)
+ template<typename V,typename R,typename Rng>
+ typename detail::result_of::convert_range<const Rng,V>::type
+ convert_range( const Rng& r,
+ typename boost::enable_if<boost::is_same<R,use_default> >::type* = 0)
     {
- typedef detail::result_of::convert_range<const Rng> caller_;
+ typedef detail::result_of::convert_range<const Rng,V> caller_;
         return caller_::call( r );
     }
 
+/*
    // operator|
        
     template<typename T,typename Rng>
@@ -131,7 +124,6 @@
         return convert_range(r);
     }
 */
-}// detail
 }// assign
 }// boost
 

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/traits/conversion_traits.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/traits/conversion_traits.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/traits/conversion_traits.hpp 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -19,11 +19,11 @@
 // A type T is mapped to a convertible type U in two steps:
 // 1) Tag = tag_of<T>::type
 // 2) U = meta::convert_to<Tag>::apply<T>::type
-// This file defines two groups:
+//
+// Groups defined in this file:
 // Tag U
-// - itself (the default) T
-// - reference_to_inner_value inner_value<T>&
-// but the use can also define his/her own as needed.
+// itself (the default) T
+// reference_to_inner_value inner_value<T>::type&
 
 namespace conversion_traits{
 

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/traits/inner_value_traits.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/traits/inner_value_traits.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/traits/inner_value_traits.hpp 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -14,14 +14,12 @@
 namespace detail{
 namespace inner_value_traits{
 
-// A type T is mapped to a an 'inner_value', U, in two steps:
+// A type T is mapped to a its inner_value, U, in two steps:
 // 1) Tag = tag_of<T>
 // 2) U = meta::inner_value<Tag>::apply<T>::type
-// This approach is useful to define a group (Tag) of types that shares the same
-// property. This file defines one group
+// This file defines one group :
 // Tag T U
 // nested_parameter W<V> V
-// but the use can also define his/her own as needed.
 
     namespace tag{
         struct nested_parameter{ typedef nested_parameter type; };

Modified: sandbox/statistics/detail/assign/boost/assign/chain_convert.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/chain_convert.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/chain_convert.hpp 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -9,6 +9,6 @@
 #ifndef BOOST_ASSIGN_CHAIN_CONVERT_ER_2010_HPP
 #define BOOST_ASSIGN_CHAIN_CONVERT_ER_2010_HPP
 
-#include <boost/assign/auto_size/chain_convert.hpp>
+#include <boost/assign/auto_size/range/chain_convert_l.hpp>
 
 #endif
\ No newline at end of file

Modified: sandbox/statistics/detail/assign/libs/assign/doc/revision_history.txt
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/doc/revision_history.txt (original)
+++ sandbox/statistics/detail/assign/libs/assign/doc/revision_history.txt 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -1,5 +1,9 @@
 // Revision history:
 //
+// March 21, 2010 : Temporarily disable comparison_op until technical fix.
+// March 21, 2010 : Removed /chain. Added /traits and /range. Implem of
+// chain_convert_l now much safer by keeping reference to previous changes and
+// the current range (similar to ref_list_of).
 // March 19, 2010 : Finished /check
 // March 18, 2010 : Commented out range() from auto_size::expr<>
 // March 16, 2010 : Added a /comparison_op to allow comparison between proxy

Modified: sandbox/statistics/detail/assign/libs/assign/example/range.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/example/range.cpp (original)
+++ sandbox/statistics/detail/assign/libs/assign/example/range.cpp 2010-03-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -10,11 +10,10 @@
 #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/range/chain_l.hpp>
+#include <boost/assign/auto_size/range/chain_convert_l.hpp>
 #include <boost/assign/auto_size/range/convert_range.hpp>
-#include <boost/assign/auto_size/reference_wrapper/conversion_traits.hpp>
 
-#include <libs/assign/example/chain.h>
+#include <libs/assign/example/range.h>
 
 void example_range(std::ostream& os)
 {
@@ -32,53 +31,31 @@
     ar_ ar4; ar4.assign( 2 );
     ar_ ar5; ar5.assign( 3 );
     ar_ ar6; ar6.assign( 6 );
-
-{
- os << " chain_l(ar4)(ar5)(ar6) = (";
- boost::copy(
- chain_l(ar4)(ar5)(ar6),
- std::ostream_iterator<val_>(os," ")
- );
- os << ") becomes (";
- boost::copy(
- chain_l(ar1)(ar2)(ar3),
- boost::begin(chain_l(ar4)(ar5)(ar6))
- );
- boost::copy(
- chain_l(ar4)(ar5)(ar6),
- std::ostream_iterator<val_>(os," ")
- );
- os << ") should equal (";
- boost::copy(
- chain_l(ar1)(ar2)(ar3),
- std::ostream_iterator<val_>(os," ")
- ); os << ')' << std::endl;
-}
+
 {
     BOOST_AUTO(tmp1,ref_list_of(a)(b));
     BOOST_AUTO(tmp2,ref_list_of(c)(d));
     BOOST_AUTO(tmp3,ref_list_of(e)(f));
     os << " chain_l(tmp1)(tmp2)(tmp3) = (";
     boost::copy(
- chain_l(tmp1)(tmp2)(tmp3),
+ chain_convert_l(tmp1)(ar5)(tmp3),
         std::ostream_iterator<val_>(os," ")
     );
     os << ") becomes (";
     boost::copy(
- chain_l(ar1)(ar2)(ar3),
- boost::begin(chain_l(tmp1)(tmp2)(tmp3))
+ chain_convert_l(ar1)(ar2)(ar3),
+ boost::begin(chain_convert_l(tmp1)(ar5)(tmp3))
     );
     boost::copy(
- chain_l(tmp1)(tmp2)(tmp3),
+ chain_convert_l(tmp1)(ar5)(tmp3),
         std::ostream_iterator<val_>(os," ")
     );
     os << ") should equal (";
     boost::copy(
- chain_l(ar1)(ar2)(ar3),
+ chain_convert_l(ar1)(ar2)(ar3),
         std::ostream_iterator<val_>(os," ")
     ); os << ')' << std::endl;
 }
-// See about mixing ar's and ref_list_of
 
         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-22 22:47:23 EDT (Mon, 22 Mar 2010)
@@ -1,6 +1,6 @@
 #include <iostream>
 #define BOOST_ASSIGN_CHECK_EQUAL(a,b) BOOST_ASSERT(a==b)
-//#include <boost/assign/auto_size/check/ref_list_of.hpp>
+#include <boost/assign/auto_size/check/ref_list_of.hpp>
 //#include <boost/assign/auto_size/check/ref_csv.hpp>
 #undef BOOST_ASSIGN_CHECK_EQUAL
 //#include <libs/assign/example/chain.h>
@@ -8,10 +8,10 @@
 
 int main (int argc, char * const argv[]) {
 
- //using namespace boost::assign::detail::auto_size;
+ using namespace boost::assign::detail::auto_size;
 
- //check_ref_list_of_int();
- //std::cout << "check_ref_list_of : ok" << std::endl;
+ check_ref_list_of_int();
+ std::cout << "check_ref_list_of : ok" << std::endl;
      //check_ref_csv_int();
      //std::cout << "check_csv : ok" << std::endl;
 


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