Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60239 - in sandbox/statistics/detail/assign: boost/assign/auto_size/detail libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-03-06 11:13:48


Author: e_r
Date: 2010-03-06 11:13:48 EST (Sat, 06 Mar 2010)
New Revision: 60239
URL: http://svn.boost.org/trac/boost/changeset/60239

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/expr.hpp | 29 ++++++++++++++++++++---------
   sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp | 6 ++----
   2 files changed, 22 insertions(+), 13 deletions(-)

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/expr.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/expr.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/expr.hpp 2010-03-06 11:13:48 EST (Sat, 06 Mar 2010)
@@ -19,8 +19,10 @@
 #include <boost/iterator/iterator_concepts.hpp>
 #include <boost/next_prior.hpp>
 #include <boost/type_traits.hpp>
+#include <boost/utility/enable_if.hpp>
 #include <boost/range.hpp>
 #include <boost/assign/list_of.hpp> // needed for assign_reference
+#include <boost/assign/auto_size/detail/has_static_size.hpp>
 #include <boost/assign/auto_size/detail/assign_reference_copy.hpp>
 #include <boost/assign/auto_size/detail/policy.hpp>
 #include <boost/assign/auto_size/detail/types.hpp>
@@ -165,6 +167,10 @@
         struct result_of_range2 : result_of_range<
             K, typename boost::range_iterator<Range>::type>{};
 
+ template<typename Range>
+ struct result_of_range3 : result_of_range2<
+ boost::remove_const<Range>::type::static_size, Range>{};
+
         public:
 
         typedef typename boost::mpl::equal_to<int_n_,int_1_>::type is_first_;
@@ -211,14 +217,19 @@
             );
         }
 
-/*
-TODO
- //template<typename Range>
- //range(Range& r) // enable if has_static_size
-
- //template<typename Range>
- //range(const Range& r) // enable if has_static_size
-*/
+ template<typename Range>
+ typename boost::lazy_enable_if_c<
+ has_static_size<Range>::value,
+ result_of_range3<Range>
+ >::type
+ range(Range& r){ return this->range<Range::static_size>(r); }
+
+ template<typename Range>
+ typename boost::lazy_enable_if_c<
+ has_static_size<Range>::value,
+ result_of_range3<const Range>
+ >::type
+ range(const Range& r){ return this->range<Range::static_size>(r); }
 
         mutable previous_ previous;
         mutable ref_ ref;
@@ -230,7 +241,7 @@
 
     // ---- write_to_array ---- //
         
- // Some library extension may one day need Nshift, not at present
+ // Some library extension may one day need Nshift, but not at present
     template<int Nshift,typename A,typename E,typename T,int N,
             template<typename> class R,typename P,bool F>
     void write_to_array(A& a,const expr<E,T,N,R,P,F>& e,false_ /*exit*/){

Modified: sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp (original)
+++ sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp 2010-03-06 11:13:48 EST (Sat, 06 Mar 2010)
@@ -33,8 +33,6 @@
 
     ints_ ints;
     {
- // cref_list_of_csv
-
             int a=1, b=2, c=3;
 
                 {
@@ -43,8 +41,8 @@
             typedef boost::mpl::int_<3> K_;
                     BOOST_AUTO(tmp,
                 cref_list_of(a)(b)(c)
- .range<3>(
- ints
+ .range(
+ array
                     )
             );
 


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