Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59615 - in sandbox/statistics/detail/assign: boost/assign boost/assign/detail libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-02-09 21:11:37


Author: e_r
Date: 2010-02-09 21:11:36 EST (Tue, 09 Feb 2010)
New Revision: 59615
URL: http://svn.boost.org/trac/boost/changeset/59615

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/cref_list_of2.hpp | 14 +++++++-------
   sandbox/statistics/detail/assign/boost/assign/detail/ref_list_of_auto_size_copy_rebind.hpp | 22 ++++++++++++----------
   sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp | 7 +++++--
   3 files changed, 24 insertions(+), 19 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-09 21:11:36 EST (Tue, 09 Feb 2010)
@@ -6,8 +6,8 @@
 // Boost Software License, Version 1.0. (See accompanying file //
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
 //////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_ASSIGN_CREF_LIST_OF_COPY_ER_2010_HPP
-#define BOOST_ASSIGN_CREF_LIST_OF_COPY_ER_2010_HPP
+#ifndef BOOST_ASSIGN_REF_LIST_OF_COPY_ER_2010_HPP
+#define BOOST_ASSIGN_REF_LIST_OF_COPY_ER_2010_HPP
 #include <boost/assign/detail/ref_list_of_auto_size_copy_rebind.hpp>
 
 // This is a variation on Boost.Assign's ref_list_of<> that deduces the number
@@ -17,7 +17,7 @@
 // Usage 2:
 // boost::array<T,3> vec = cref_list_of(a)(b)(c);
 // Usage 3:
-// boost::fill( cref_list_of(a)(b)(c), 0);
+// boost::fill( ref_list_of(a)(b)(c), 0);
 //
 // See detail/ref_list_of_auto_size_copy_rebind.hpp for detail
 
@@ -25,16 +25,16 @@
 namespace assign{
 
     template<typename T>
- typename cref_list_of_impl::first<const T>::type
+ typename cref_list_of_impl::copy_first<const T>::type
     cref_list_of(const T& t){
- typedef typename cref_list_of_impl::first<const T>::type expr_;
+ typedef typename cref_list_of_impl::copy_first<const T>::type expr_;
         return expr_(t);
     }
 
     template<typename T>
- typename cref_list_of_impl::first<T>::type
+ typename cref_list_of_impl::copy_first<T>::type
     ref_list_of(T& t){
- typedef typename cref_list_of_impl::first<T>::type expr_;
+ typedef typename cref_list_of_impl::copy_first<T>::type expr_;
         return expr_(t);
     }
 

Modified: sandbox/statistics/detail/assign/boost/assign/detail/ref_list_of_auto_size_copy_rebind.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/detail/ref_list_of_auto_size_copy_rebind.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/detail/ref_list_of_auto_size_copy_rebind.hpp 2010-02-09 21:11:36 EST (Tue, 09 Feb 2010)
@@ -19,9 +19,8 @@
 #include <boost/assign/list_of.hpp> // needed for assign_referene
 #include <boost/assign/detail/assign_value.hpp>
 
-// This supplies the implementation to both ref_list_of() and ref_list_rebind()
-// which unlike ref_list_of<int>(), deduce the size of the number of items
-// automatically.
+// This is the implementation behind ref_list_of() and ref_list_rebind() which,
+// unlike ref_list_of<int>(), deduces the size of the number of items.
 //
 // Acknowledgement: The idea of this class was developed in collaboration
 // with M.P.G
@@ -41,6 +40,7 @@
             
         typedef boost::mpl::void_ top_;
 
+ // Rebind semantics
     template<typename T>
     struct ref_bind{
         typedef boost::assign_detail::assign_reference<T> type;
@@ -52,7 +52,6 @@
         typedef boost::assign_detail::assign_value<T> type;
     };
             
- // Rebind semantics
     template<typename T,int N,template<typename> class Ref>
     struct ref_array{
         typedef boost::array<typename Ref<T>::type,N> type;
@@ -67,7 +66,7 @@
         typedef expr<expr_,T,N+1,Ref> type;
     };
             
- template<typename E,typename T,int N,template<typename> class Ref = ref_value>
+ template<typename E,typename T,int N,template<typename> class Ref>
     class expr{
         typedef boost::mpl::int_<N> int_n_;
         typedef boost::mpl::int_<1> int_1_;
@@ -161,28 +160,31 @@
     typedef boost::mpl::bool_<false> false_;
     typedef boost::mpl::bool_<true> true_;
             
- template<typename A,typename E,typename T,int N,template<typename> class Ref>
+ template<typename A,typename E,typename T,int N,
+ template<typename> class Ref>
     void write_to_array(A& a,expr<E,T,N,Ref>& e){
         typedef expr<E,T,N,Ref> expr_;
         typedef typename expr_::is_first_ exit_;
         write_to_array(a,e,exit_());
     }
             
- template<typename A,typename E,typename T,int N,template<typename> class Ref>
+ template<typename A,typename E,typename T,int N,
+ template<typename> class Ref>
     void write_to_array(A& a,expr<E,T,N,Ref>& e,false_ /*exit*/){
         a[N-1] = e.ref;
         write_to_array(a,e.previous);
     }
             
- template<typename A,typename E,typename T,int N,template<typename> class Ref>
+ template<typename A,typename E,typename T,int N,
+ template<typename> class Ref>
     void write_to_array(A& a,expr<E,T,N,Ref>& e,true_ /*exit*/){
         a[N-1] = e.ref;
     }
             
     template<typename T>
- struct first{
+ struct copy_first{
         typedef cref_list_of_impl::expr<
- cref_list_of_impl::top_,T,1> type;
+ cref_list_of_impl::top_,T,1,ref_value> type;
     };
 
     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-09 21:11:36 EST (Tue, 09 Feb 2010)
@@ -88,8 +88,9 @@
                         BOOST_ASSERT(b == 0);
                         BOOST_ASSERT(c == 0);
         }
+ // ref_list_of_rebind
                 {
- int a=1, b=2, c=3, d = 4;
+ int a=1, b=2, c=3;
                     ints.clear();
                 BOOST_AUTO(
                 tmp,
@@ -107,6 +108,8 @@
                                 BOOST_ASSERT(ints[1] == b);
                                 BOOST_ASSERT(ints[2] == c);
             }
+
+ int d = 4;
             std::fill(boost::begin(tmp),boost::end(tmp),d);
             {
                         ints = ints_(boost::begin(tmp),boost::end(tmp));
@@ -115,7 +118,7 @@
                                 BOOST_ASSERT(ints[2] == d);
             }
             {
- // Before rev. Feb 8, 2010, there was an inconsistency here
+ // Before rev. Feb 9, 2010, this required a,b,c, respectively
                         ints = tmp;
                                 BOOST_ASSERT(ints[0] == d);
                                 BOOST_ASSERT(ints[1] == d);


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