|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60597 - in sandbox/statistics/detail/assign: boost/assign/auto_size/array boost/assign/auto_size/chain boost/assign/auto_size/check libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-03-14 19:34:11
Author: e_r
Date: 2010-03-14 19:34:10 EDT (Sun, 14 Mar 2010)
New Revision: 60597
URL: http://svn.boost.org/trac/boost/changeset/60597
Log:
m
Text files modified:
sandbox/statistics/detail/assign/boost/assign/auto_size/array/interface.hpp | 2
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/as_member.hpp | 47 ++++++++++++++++++---------------------
sandbox/statistics/detail/assign/boost/assign/auto_size/chain/chain_convert.hpp | 29 ++++++++++++-----------
sandbox/statistics/detail/assign/boost/assign/auto_size/check/chain.hpp | 10 ++++----
sandbox/statistics/detail/assign/libs/assign/example/chain.cpp | 16 ++++++++-----
5 files changed, 53 insertions(+), 51 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-14 19:34:10 EDT (Sun, 14 Mar 2010)
@@ -52,7 +52,7 @@
array_interface<T,N,R,D>,
typename array_interface_traits<T,N,R>::const_iterator
>
- ,public detail::chain_as_member<array_interface<T,N,R,D> >
+ //,public detail::chain_as_member<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/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 19:34:10 EDT (Sun, 14 Mar 2010)
@@ -8,48 +8,45 @@
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_ASSIGN_AUTO_SIZE_DETAIL_ARRAY_CHAINABLE_ER_2010_HPP
#define BOOST_ASSIGN_AUTO_SIZE_DETAIL_ARRAY_CHAINABLE_ER_2010_HPP
+#include <boost/type_traits/add_const.hpp>
#include <boost/assign/auto_size/chain/chain_convert.hpp>
namespace boost{
namespace assign{
namespace detail{
- // D is a derived type
+
+ // D is a derived type that is boost::chain'able
template<typename D>
class chain_as_member{
template<bool add_const>
struct adaptor :
- adaptor::chain_convert<typename boost::add_const<D>::type>
-
-
+ assign::adaptor::chain_convert<
+ typename boost::add_const<D>::type
+ >{};
+
+ template<typename R,bool add_const>
+ struct result_impl
+ : adaptor<add_const>::template result_impl<R,add_const>{};
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
+ // TODO : complete
+ // chain_convert(R&);
+ // chain_convert(const R&);
+
+ typename adaptor<false>::type
+ chain_convert_l_adaptor(){
+ return assign::chain_convert_l(
+ static_cast<D&>(*this)
);
}
- template<typename R>
- typename result_of_chain_convert<const D>::type
- chain_convert_adaptor()const{
- return assign::chain_convert(
- static_cast<const D&>(*this),
- r
+ typename adaptor<true>::type
+ chain_convert_r_adaptor()const{
+ return assign::chain_convert_r(
+ static_cast<const D&>(*this)
);
}
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 19:34:10 EDT (Sun, 14 Mar 2010)
@@ -9,6 +9,7 @@
#ifndef BOOST_ASSIGN_DETAIL_CHAIN_CONVERT_ER_2010_HPP
#define BOOST_ASSIGN_DETAIL_CHAIN_CONVERT_ER_2010_HPP
#include <boost/mpl/if.hpp>
+#include <boost/mpl/not.hpp>
#include <boost/range.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits.hpp>
@@ -23,17 +24,17 @@
// http://gist.github.com/287791
// developed by MPG.
-
-
namespace adaptor{
-
template<typename R1,
typename Conv = detail::pair_traits::meta::apply_conversion>
class chain_convert
: public boost::sub_range<R1>
{
+ // typedef typename boost::is_const<R1>::type r1_is_const_;
+ // typedef typename boost::mpl::not_<r1_is_const_>::type allow_lvalue_;
+
typedef sub_range<R1> super_;
template<typename R,bool add_const>
@@ -54,8 +55,8 @@
// 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,
+ typename qual<super_,add_const>::type,
+ typename qual<R2,add_const>::type
>{};
template<typename S>
@@ -94,7 +95,7 @@
template<typename Conv,typename R>
adaptor::chain_convert<Conv,R>
-chain_convert(R & r)
+chain_convert_l(R & r)
{
typedef adaptor::chain_convert<Conv,R> result_;
return result_(r);
@@ -102,7 +103,7 @@
template<typename Conv,typename R>
adaptor::chain_convert<Conv,const R>
-chain_convert(const R & r)
+chain_convert_r(const R & r)
{
typedef adaptor::chain_convert<Conv,const R> result_;
return result_(r);
@@ -129,7 +130,7 @@
template<typename R>
adaptor::chain_convert<R>
-chain_convert(R & r)
+chain_convert_l(R & r)
{
typedef adaptor::chain_convert<R> result_;
return result_(r);
@@ -137,27 +138,27 @@
template<typename R>
adaptor::chain_convert<const R>
-chain_convert(const R & r)
+chain_convert_r(const R & r) // force const
{
typedef adaptor::chain_convert<const R> result_;
return result_(r);
}
-/*
+
template<typename R1, typename R2>
-typename result_of::chain_convert<R2>::template apply<R1>::type
+typename adaptor::chain_convert<R2>::template result_impl<R1,false>::type
operator|(R1 & r1, const adaptor::chain_convert<R2>& adaptor)
{
return adaptor(r1);
}
template<typename R1, typename R2>
-typename result_of::chain_convert<R2>::template apply<const R1>::type
-operator|(const R1 & r1, const adaptor::chain_convert<R2> & adaptor)
+typename adaptor::chain_convert<const R2>::template result_impl<R1,true>::type
+operator|(R1 & r1, const adaptor::chain_convert<const R2>& adaptor)
{
return adaptor(r1);
}
-*/
+
}// assign
}// boost
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 19:34:10 EDT (Sun, 14 Mar 2010)
@@ -45,11 +45,11 @@
ar[1] = f;
ar[2] = g;
ar[3] = 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);
+ BOOST_AUTO(tmp1,chain_convert_l(coll)(ar));
+ BOOST_AUTO(tmp2,chain_convert_r(coll)(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
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-14 19:34:10 EDT (Sun, 14 Mar 2010)
@@ -36,24 +36,28 @@
boost::copy(
- chain_convert(tmp2)(ar4),
+ chain_convert_r(tmp2)(ar4),
std::ostream_iterator<val_>(os," ")
); os << " --- becomes ---> ";
boost::copy(
- chain_convert(tmp1)(ar2),
- boost::begin(chain_convert(tmp2)(ar4))
+ chain_convert_r(tmp1)(ar2),
+ boost::begin(chain_convert_l(tmp2)(ar4))
);
boost::copy(
- chain_convert(tmp2)(ar4),
+ chain_convert_r(tmp2)(ar4),
std::ostream_iterator<val_>(os," ")
); os << " --- that should equal ---> ";
boost::copy(
- chain_convert(ref_list_of(a)(b)(c)(d))(ar2),
+ chain_convert_r(ref_list_of(a)(b)(c)(d))(ar2),
std::ostream_iterator<val_>(os," ")
- );
+ ); os << " ---, half segments interverted ---> ";
+ boost::copy(
+ chain_convert_r(ref_list_of(a)(b)(c)(d))(ar2),
+ std::ostream_iterator<val_>(os," ")
+ ); // this is a case where without _r, there would be compile error
// Why chain_convert is required :
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