Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59484 - in sandbox/statistics/detail/assign: boost/assign libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-02-04 18:15:47


Author: e_r
Date: 2010-02-04 18:15:46 EST (Thu, 04 Feb 2010)
New Revision: 59484
URL: http://svn.boost.org/trac/boost/changeset/59484

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/cref_list_of2.hpp | 19 ++++++++-----------
   sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp | 21 ++++++++++++++++++---
   2 files changed, 26 insertions(+), 14 deletions(-)

Modified: sandbox/statistics/detail/assign/boost/assign/cref_list_of2.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/cref_list_of2.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/cref_list_of2.hpp 2010-02-04 18:15:46 EST (Thu, 04 Feb 2010)
@@ -52,26 +52,24 @@
     };
             
     template<typename E,typename T,int N>
- struct expr{
+ class expr{
         typedef boost::mpl::int_<N> int_n_;
         typedef boost::mpl::int_<1> int_1_;
+ typedef typename ref<T>::type ref_;
+
+ public:
         typedef typename boost::mpl::equal_to<int_n_,int_1_>::type is_first_;
-
         typedef typename boost::mpl::if_<is_first_,E,E&>::type previous_;
-
- typedef typename ref<T>::type ref_;
         typedef typename ref_array<T,N>::type ref_array_;
+ typedef typename next<E,T,N>::type next_;
 
         previous_ previous;
- typedef typename next<E,T,N>::type next_;
         ref_ ref;
-
- // public:
- typedef next_ result_type;
-
+
         expr(T& t):ref(t){} // only for N == 1
         expr(E& p,T& t):previous(p),ref(t){}
                 
+ typedef next_ result_type;
         next_ operator()(T& t){ return next_(*this,t); }
                 
         template<typename T1>
@@ -119,7 +117,7 @@
             return !(this->size());
         }
                 
- // private:
+ private:
         void alloc(){
             this->ptr = smart_ptr_(new ref_array_);
             write_to_array(*ptr,*this);
@@ -163,7 +161,6 @@
                 cref_list_of2_impl::top_,T,1> type;
     };
             
-
 }// cref_list_of2_impl
         
     template<typename T>

Modified: sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp (original)
+++ sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp 2010-02-04 18:15:46 EST (Thu, 04 Feb 2010)
@@ -6,9 +6,9 @@
 // Boost Software License, Version 1.0. (See accompanying file //
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
 //////////////////////////////////////////////////////////////////////////////
-#include <boost/timer.hpp>
 #include <ostream>
 #include <vector>
+#include <algorithm>
 #include <boost/typeof/typeof.hpp>
 #include <boost/assign/list_of.hpp>
 #include <boost/assign/cref_list_of2.hpp>
@@ -72,7 +72,6 @@
                 BOOST_ASSERT(array[0] == a);
                 BOOST_ASSERT(array[1] == b);
                 BOOST_ASSERT(array[2] == c);
-
                 {
                     ints.clear();
                 BOOST_AUTO(
@@ -83,10 +82,26 @@
                         BOOST_ASSERT(ints[0] == a);
                         BOOST_ASSERT(ints[1] == b);
                         BOOST_ASSERT(ints[2] == c);
- }
+ typedef boost::assign_detail::assign_reference<int> ref_;
+ typedef boost::array<ref_,3> ref_array_;
+ typedef boost::range_iterator<ref_array_>::type it_;
+ ref_array_ ref_array = tmp;
+ it_ it = boost::begin(ref_array);
+ it_ e = boost::end(ref_array);
+ while(it!=e){
+ int& i = (*it); // alt : b->get_ref();
+ i = 0;
+ ++it;
+ }
+ BOOST_ASSERT(a == 0);
+ BOOST_ASSERT(b == 0);
+ BOOST_ASSERT(c == 0);
+ }
         
     }
 
+
+
         os << "<- " << 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