|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60757 - in sandbox/statistics/detail/assign: boost/assign/auto_size/array boost/assign/auto_size/chain boost/assign/auto_size/check boost/assign/auto_size/detail boost/assign/auto_size/reference_wrapper libs/assign/example libs/assign/src
From: erwann.rogard_at_[hidden]
Date: 2010-03-21 23:59:46
Author: e_r
Date: 2010-03-21 23:59:45 EDT (Sun, 21 Mar 2010)
New Revision: 60757
URL: http://svn.boost.org/trac/boost/changeset/60757
Log:
m
Text files modified:
sandbox/statistics/detail/assign/boost/assign/auto_size/array/converter.hpp | 16 ++++---
sandbox/statistics/detail/assign/boost/assign/auto_size/array/interface.hpp | 2
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/convert_range.hpp | 73 +++++++++++++++++++++++++++++++--------
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/pair_range_traits.hpp | 4 +-
sandbox/statistics/detail/assign/boost/assign/auto_size/check/all.hpp | 24 ++++++-------
sandbox/statistics/detail/assign/boost/assign/auto_size/check/chain.hpp | 46 ++++++++++++++----------
sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy.hpp | 34 ++++++------------
sandbox/statistics/detail/assign/boost/assign/auto_size/reference_wrapper/copy.hpp | 3 -
sandbox/statistics/detail/assign/libs/assign/example/chain.cpp | 24 +++++-------
sandbox/statistics/detail/assign/libs/assign/src/main.cpp | 20 ++++++----
10 files changed, 141 insertions(+), 105 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-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -23,14 +23,10 @@
, public range_comparison_op::base_of< T >::type
{
typedef boost::assign_detail::converter<T,I> impl_;
- protected:
+ //protected:
impl_& impl(){ return (*this); }
const impl_& impl()const{ return (*this); }
-
- public:
- typedef typename impl_::iterator iterator;
- typedef typename impl_::const_iterator const_iterator;
-
+/*
iterator begin() const
{
return this->impl().begin();
@@ -40,7 +36,13 @@
{
return this->impl().end();
}
-
+
+
+*/
+ public:
+ typedef typename impl_::iterator iterator;
+ typedef typename impl_::const_iterator const_iterator;
+
template< class Container >
Container convert_to_container() const
{
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-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -117,7 +117,7 @@
void swap_impl(array_interface& other,boost::mpl::int_<N1>){
reference lhs = (*this)[N1-1];
reference rhs = (other)[N1-1];
- lhs.swap(rhs); //TODO should be able to call swap(lhs,rhs)
+ lhs.swap(rhs);
typedef boost::mpl::int_<N1-1> next_int_;
this->swap_impl(other,next_int_());
}
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/chain/convert_range.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/chain/convert_range.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/chain/convert_range.hpp 2010-03-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -14,25 +14,34 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/assign/auto_size/chain/convert_iterator.hpp>
+#include <boost/assign/auto_size/chain/reference_traits.hpp>
// Usage:
// convert_range<T>(r)
-// changes range_reference<R>::type to T.
+// changes U = range_reference<R>::type to T.
+// convert_range(r)
+// changes U to reference_traits::convert_to<U>::type
namespace boost{
namespace assign{
namespace detail{
namespace adaptor{
-template<typename T>
+struct use_default;
+
+template<typename T = use_default>
struct convert_range{ convert_range(){} };
}// adaptor
namespace result_of{
- template<typename T,typename Rng,
- typename U = typename boost::range_reference<Rng>::type>
+ template<
+ typename Rng,
+ typename T = typename reference_traits::convert_to<
+ typename boost::range_reference<Rng>::type
+ >::type
+ >
struct convert_range
{
typedef adaptor::convert_range<T> adaptor_;
@@ -41,7 +50,8 @@
typedef boost::iterator_range<new_it_> type;
static void internal_check(){
- BOOST_MPL_ASSERT((boost::is_convertible<U,T>));
+ 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>));
}
@@ -53,40 +63,73 @@
);
}
};
-
+
}
+ // convert_range
+
template<typename T,typename Rng>
- typename detail::result_of::convert_range<T,Rng>::type
+ typename detail::result_of::convert_range<Rng,T>::type
convert_range( Rng& r)
{
- typedef detail::result_of::convert_range<T,Rng> caller_;
+ typedef detail::result_of::convert_range<Rng,T> caller_;
return caller_::call( r );
}
template<typename T,typename Rng>
- typename detail::result_of::convert_range<T,const Rng>::type
+ typename detail::result_of::convert_range<const Rng,T>::type
convert_range( const Rng& r)
{
- return convert_range<T,const Rng>(r);
+ typedef detail::result_of::convert_range<const Rng,T> caller_;
+ return caller_::call( r );
}
-
+
+ template<typename Rng>
+ typename detail::result_of::convert_range<Rng>::type
+ convert_range( Rng& r)
+ {
+ typedef detail::result_of::convert_range<Rng> caller_;
+ return caller_::call( r );
+ }
+
+ template<typename Rng>
+ typename detail::result_of::convert_range<const Rng>::type
+ convert_range( const Rng& r)
+ {
+ typedef detail::result_of::convert_range<const Rng> caller_;
+ return caller_::call( r );
+ }
+
+ // operator|
+
template<typename T,typename Rng>
- inline typename detail::result_of
- ::convert_range<T,Rng>::type
+ inline typename detail::result_of::convert_range<Rng,T>::type
operator|( Rng& r, const detail::adaptor::convert_range<T>& f )
{
return convert_range<T>(r);
}
template<typename T,typename Rng>
- inline typename detail::result_of
- ::convert_range<T,const Rng>::type
+ inline typename detail::result_of::convert_range<const Rng,T>::type
operator|( const Rng& r, const detail::adaptor::convert_range<T>& f )
{
return convert_range<T>(r);
}
+ template<typename Rng>
+ inline typename detail::result_of::convert_range<Rng>::type
+ operator|( Rng& r, const detail::adaptor::convert_range<>& f )
+ {
+ return convert_range(r);
+ }
+
+ template<typename Rng>
+ inline typename detail::result_of::convert_range<const Rng>::type
+ operator|( const Rng& r, const detail::adaptor::convert_range<>& f )
+ {
+ return convert_range(r);
+ }
+
}// detail
}// assign
}// boost
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-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -30,8 +30,8 @@
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_;
+ typedef detail::result_of::convert_range<R1,convertible_to_> caller1_;
+ typedef detail::result_of::convert_range<R2,convertible_to_> caller2_;
typedef typename caller1_::type new_range1_;
typedef typename caller2_::type new_range2_;
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-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -39,21 +39,11 @@
\
template<typename T> \
void fun(){ \
- BOOST_ASSIGN_AS_CHECK_copy_array \
-} \
-void BOOST_PP_CAT(fun,_int)(){ fun<int>(); } \
-} \
-} \
-} \
-} \
-/**/
-
-/*
BOOST_ASSIGN_AS_CHECK_example1 \
BOOST_ASSIGN_AS_CHECK_iterator \
BOOST_ASSIGN_AS_CHECK_array \
BOOST_ASSIGN_AS_CHECK_copy_iterator \
-
+ BOOST_ASSIGN_AS_CHECK_copy_array \
BOOST_ASSIGN_AS_CHECK_rebind_array \
BOOST_ASSIGN_AS_CHECK_converter(std::list<T>) \
BOOST_ASSIGN_AS_CHECK_converter(std::vector<T>) \
@@ -63,10 +53,18 @@
BOOST_ASSIGN_AS_CHECK_adapter_lifo(std::stack<T>) \
BOOST_ASSIGN_AS_CHECK_adapter_fifo(std::queue<T>) \
BOOST_ASSIGN_AS_CHECK_comparison_op \
- BOOST_ASSIGN_AS_CHECK_example2 \
+} \
+void BOOST_PP_CAT(fun,_int)(){ fun<int>(); } \
+} \
+} \
+} \
+} \
+/**/
+
+/*
BOOST_ASSIGN_AS_CHECK_chain \
+ BOOST_ASSIGN_AS_CHECK_example2 \
*/
-
#endif
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-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -10,7 +10,8 @@
#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/chain_convert.hpp>
+#include <boost/range/algorithm/copy.hpp>
+#include <boost/assign/auto_size/chain/chain.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>
@@ -38,42 +39,47 @@
BOOST_AUTO(tmp1,BOOST_ASSIGN_AS_CHECK_ref3(a1,b1,c1)); \
BOOST_AUTO(tmp2,BOOST_ASSIGN_AS_CHECK_ref3(d1,e1,f1)); \
BOOST_AUTO(tmp3,BOOST_ASSIGN_AS_CHECK_ref2(g1,h1)); \
- check_iterator_impl( boost::begin( chain_convert_r(ar1)(ar2)(ar3) ) ); \
- check_iterator_impl( boost::begin( chain_convert_r(ar1)(ar2)(tmp3) ) ); \
- check_iterator_impl( boost::begin( chain_convert_r(ar1)(tmp2)(ar3) ) ); \
- check_iterator_impl( boost::begin( chain_convert_r(ar1)(tmp2)(tmp3) ) ); \
- check_iterator_impl( boost::begin( chain_convert_r(tmp1)(ar2)(ar3) ) ); \
- check_iterator_impl( boost::begin( chain_convert_r(tmp1)(ar2)(tmp3) ) ); \
- check_iterator_impl( boost::begin( chain_convert_r(tmp1)(tmp2)(ar3) ) ); \
- check_iterator_impl( boost::begin( chain_convert_r(tmp1)(tmp2)(tmp3) ) ); \
+ boost::copy(chain_r(ar1)(ar2)(ar3),std::ostream_iterator<T>(std::cout," ")); \
+ check_iterator_impl( boost::begin( chain_r(ar1)(ar2)(ar3) ) ); \
+} \
+/**/
+
+#endif
+
+/*
+ check_iterator_impl( boost::begin( chain_r(ar1)(ar2)(tmp3) ) ); \
+ check_iterator_impl( boost::begin( chain_r(ar1)(tmp2)(ar3) ) ); \
+ check_iterator_impl( boost::begin( chain_r(ar1)(tmp2)(tmp3) ) ); \
+ check_iterator_impl( boost::begin( chain_r(tmp1)(ar2)(ar3) ) ); \
+ check_iterator_impl( boost::begin( chain_r(tmp1)(ar2)(tmp3) ) ); \
+ check_iterator_impl( boost::begin( chain_r(tmp1)(tmp2)(ar3) ) ); \
+ check_iterator_impl( boost::begin( chain_r(tmp1)(tmp2)(tmp3) ) ); \
ar[0] = a; ar[1] = b; ar[2] = c; \
ar[3] = d; ar[4] = e; ar[5] = f; \
ar[6] = g; ar[7] = h; \
- boost::copy(ar, boost::begin(chain_convert_l(ar1)(ar2)(ar3))); \
+ boost::copy(ar, boost::begin(chain_l(ar1)(ar2)(ar3))); \
check_values_impl( \
ar1[0],ar1[1],ar1[2],ar2[0],ar2[1],ar2[2],ar3[0],ar3[1]); \
- boost::copy(ar, boost::begin(chain_convert_l(ar1)(ar2)(tmp3))); \
+ boost::copy(ar, boost::begin(chain_l(ar1)(ar2)(tmp3))); \
check_values_impl( \
ar1[0],ar1[1],ar1[2],ar2[0],ar2[1],ar2[2], g1 , h1 ); \
- boost::copy(ar, boost::begin(chain_convert_l(ar1)(tmp2)(ar3))); \
+ boost::copy(ar, boost::begin(chain_l(ar1)(tmp2)(ar3))); \
check_values_impl( \
ar1[0],ar1[1],ar1[2], d1 , e1 , f1 ,ar3[0],ar3[1]); \
- boost::copy(ar, boost::begin(chain_convert_l(ar1)(tmp2)(tmp3))); \
+ boost::copy(ar, boost::begin(chain_l(ar1)(tmp2)(tmp3))); \
check_values_impl( \
ar1[0],ar1[1],ar1[2], d1 , e1 , f1 , g1 , h1 ); \
- boost::copy(ar, boost::begin(chain_convert_l(tmp1)(ar2)(ar3))); \
+ boost::copy(ar, boost::begin(chain_l(tmp1)(ar2)(ar3))); \
check_values_impl( \
a1 , b1 , c1 ,ar2[0],ar2[1],ar2[2],ar3[0],ar3[1]); \
- boost::copy(ar, boost::begin(chain_convert_l(tmp1)(ar2)(tmp3))); \
+ boost::copy(ar, boost::begin(chain_l(tmp1)(ar2)(tmp3))); \
check_values_impl( \
a1 , b1 , c1 ,ar2[0],ar2[1],ar2[2], g1 , h1 ); \
- boost::copy(ar, boost::begin(chain_convert_l(tmp1)(tmp2)(ar3))); \
+ boost::copy(ar, boost::begin(chain_l(tmp1)(tmp2)(ar3))); \
check_values_impl( \
a1 , b1 , c1 , d1 , e1 , f1 ,ar3[0],ar3[1]); \
- boost::copy(ar, boost::begin(chain_convert_l(tmp1)(tmp2)(tmp3))); \
+ boost::copy(ar, boost::begin(chain_l(tmp1)(tmp2)(tmp3))); \
check_values_impl( \
a1 , b1 , c1 , d1 , e1 , f1 , g1 , h1 ); \
-} \
-/**/
-#endif
+*/
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy.hpp 2010-03-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -15,32 +15,22 @@
namespace detail{
namespace auto_size{
- namespace tag{
- struct no_policy{};
+ namespace tag{ struct no_policy{}; }
+ namespace impl{
+ struct no_policy{
+ template<typename E,template<typename> class Ref>
+ struct apply{
+ typedef boost::mpl::empty_base type;
+ };
+ };
}
- template<typename Tag>
- struct policy{
- typedef Tag tag;
- };
+ template<typename Tag> struct policy{ typedef Tag tag; };
+ template<> struct policy<tag::no_policy> : impl::no_policy{};
- template<typename Tag>
- struct csv_policy{
- typedef Tag tag;
- };
+ template<typename Tag> struct csv_policy{ typedef Tag tag; };
+ template<> struct csv_policy<tag::no_policy> : impl::no_policy{};
- template<>
- struct policy<tag::no_policy>{
- template<typename E,template<typename> class Ref>
- struct apply{
- typedef boost::mpl::empty_base type;
- };
- };
-
- template<>
- struct csv_policy<tag::no_policy>
- : policy<tag::no_policy>{};
-
}// auto_size
}// detail
}// assign
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-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -8,7 +8,7 @@
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_ASSIGN_DETAIL_ASSIGN_REFERENCE_COPY_MPG_2010_HPP
#define BOOST_ASSIGN_DETAIL_ASSIGN_REFERENCE_COPY_MPG_2010_HPP
-#include <iostream> // tmp
+
namespace boost{
namespace assign{
namespace detail{
@@ -40,7 +40,6 @@
void swap( assign_reference_copy& r )
{
- std::cout << "copy::swap" << std::endl;
std::swap( *this->ref_, *r.ref_ );
}
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-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -5,6 +5,7 @@
#include <ostream>
#include <iterator>
#include <vector>
+#include <boost/concept/assert.hpp>
#include <boost/array.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/next_prior.hpp>
@@ -12,7 +13,7 @@
#include <boost/assign/auto_size/ref_list_of.hpp>
#include <boost/assign/auto_size/detail/expr.hpp>
#include <boost/assign/auto_size/reference_wrapper/conversion_traits.hpp>
-#include <boost/assign/auto_size/chain/chain_convert.hpp>
+//#include <boost/assign/auto_size/chain/chain.hpp>
//#include <boost/assign/auto_size/comparison_op/crtp.hpp>
#include <libs/assign/example/chain.h>
@@ -34,42 +35,37 @@
ar_ ar3; ar3.assign( 1 );
ar_ ar4; ar4.assign( 2 );
ar_ ar5; ar5.assign( 3 );
- BOOST_AUTO(tmp1,ref_list_of(a)(b)(c)(d));
+ typedef detail::auto_size::n_th_expr_copy<val_,4>::type res4_;
+ res4_ tmp1 = ref_list_of(a)(b)(c)(d);
BOOST_AUTO(tmp2,ref_list_of(e)(f)(g)(h));
- BOOST_ASSERT(tmp1 != tmp2);
- BOOST_ASSERT(tmp1 != ar1);
- BOOST_ASSERT(ar1 != tmp1);
-
/*
boost::copy(
- chain_convert_r(tmp2)(ar4)(ar5),
+ chain_r(tmp2)(ar4)(ar5),
std::ostream_iterator<val_>(os," ")
); os << " --- becomes ---> " << std::endl;
- BOOST_AUTO(tmp,chain_convert_l(tmp2)(ar4)(ar5));
-
boost::copy(
- chain_convert_r(tmp1)(ar2)(ar3),
+ chain_r(tmp1)(ar2)(ar3),
boost::begin(tmp)
);
boost::copy(
- chain_convert_r(tmp2)(ar4)(ar5),
+ chain_r(tmp2)(ar4)(ar5),
std::ostream_iterator<val_>(os," ")
); os << " --- that should equal ---> "<< std::endl;
boost::copy(
- chain_convert_r(ref_list_of(a)(b)(c)(d))(ar2)(ar3),
+ chain_r(ref_list_of(a)(b)(c)(d))(ar2)(ar3),
std::ostream_iterator<val_>(os," ")
); os << " --- tier segments in reverse order ---> " << std::endl;
boost::copy(
- chain_convert_r(ar3)(ar2)(ref_list_of(a)(b)(c)(d)),
+ chain_r(ar3)(ar2)(ref_list_of(a)(b)(c)(d)),
std::ostream_iterator<val_>(os," ")
); // this is a case where without _r, there would be compile error
- // Why chain_convert is required :
+ // Why chain is required :
//invalid initialization of reference of type 'boost::assign::detail::assign_reference_copy<example_chain::val_>&'
// from expression of type 'int'
//boost::copy(
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-21 23:59:45 EDT (Sun, 21 Mar 2010)
@@ -1,20 +1,22 @@
#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_csv.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>
+//#include <libs/assign/example/chain.h>
+#include <libs/assign/example/range.h>
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_csv_int();
- std::cout << "check_csv : 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;
- example_chain(std::cout);
+// example_chain(std::cout);
+ example_range(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