Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59902 - in sandbox/statistics/detail/assign: boost/assign/auto_size boost/assign/auto_size/detail libs/assign/doc libs/assign/example libs/assign/test
From: erwann.rogard_at_[hidden]
Date: 2010-02-25 09:08:32


Author: e_r
Date: 2010-02-25 09:08:31 EST (Thu, 25 Feb 2010)
New Revision: 59902
URL: http://svn.boost.org/trac/boost/changeset/59902

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp | 2 +-
   sandbox/statistics/detail/assign/boost/assign/auto_size/ref_list_of.hpp | 25 ++++++++++---------------
   sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of.hpp | 28 +++++++++++-----------------
   sandbox/statistics/detail/assign/libs/assign/doc/cref_list_of2_speed.txt | 12 ++++++------
   sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp | 10 +++++-----
   sandbox/statistics/detail/assign/libs/assign/test/cref_list_of2_speed.cpp | 26 +++++++++++++-------------
   sandbox/statistics/detail/assign/libs/assign/test/static_list_of_auto_size.cpp | 16 ++++++++--------
   7 files changed, 54 insertions(+), 65 deletions(-)

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp 2010-02-25 09:08:31 EST (Thu, 25 Feb 2010)
@@ -19,7 +19,7 @@
 #include <boost/assign/list_of.hpp> // needed for assign_referene
 #include <boost/assign/auto_size/detail/assign_refence_copy.hpp>
 
-// This is the implementation behind ref_list_of() and ref_copy_list_of().
+// This is the implementation behind ref_rebind_list_of() and ref_list_of().
 //
 // This approach improves upon ref_list_of<int>() by deducing the number of
 // arguments at compile time and factors the reference wrapper into a template

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/ref_list_of.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/ref_list_of.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/ref_list_of.hpp 2010-02-25 09:08:31 EST (Thu, 25 Feb 2010)
@@ -1,39 +1,34 @@
 //////////////////////////////////////////////////////////////////////////////
-// assign::ref_copy_list_of.hpp //
+// assign::ref_list_of.hpp //
 // //
 // (C) Copyright 2010 Erwann Rogard //
 // Use, modification and distribution are subject to the //
 // 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_AUTO_SIZE_REF_COPY_LIST_OF_ER_2010_HPP
-#define BOOST_ASSIGN_AUTO_SIZE_REF_COPY_LIST_OF_ER_2010_HPP
+#ifndef BOOST_ASSIGN_AUTO_SIZE_REF_LIST_OF_ER_2010_HPP
+#define BOOST_ASSIGN_AUTO_SIZE_REF_LIST_OF_ER_2010_HPP
 #include <boost/assign/auto_size/detail/auto_size.hpp>
 
-// Usage 1:
-// std::vector<T> elems = cref_copy_list_of(a)(b)(c);
-// Usage 2:
-// boost::array<T,3> elems = cref_copy_list_of(a)(b)(c);
-// Usage 3:
-// boost::fill( ref_list_of(a)(b)(c), 0);
-//
-// The infix 'copy' emphasizes that copy semantics are used, which is the
-// preferable choice in most situations, in constrast to ref_list_of() which
-// has rebind semantics.
+// This function supersedes ref_list_of<int>() as it deduces the number of
+// elements from the arguments but also uses copy rather than rebind semantics,
+// if used as the lhs of an assignement :
+// boost::fill(ref_list_of(a)(b)(c),0)
+// assigns 0 to a,b,c.
 
 namespace boost{
 namespace assign{
 
     template<typename T>
     typename detail::auto_size::copy_first<const T>::type
- cref_copy_list_of(const T& t){
+ cref_list_of(const T& t){
         typedef typename detail::auto_size::copy_first<const T>::type expr_;
         return expr_(t);
     }
 
     template<typename T>
     typename detail::auto_size::copy_first<T>::type
- ref_copy_list_of(T& t){
+ ref_list_of(T& t){
         typedef typename detail::auto_size::copy_first<T>::type expr_;
         return expr_(t);
     }

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of.hpp 2010-02-25 09:08:31 EST (Thu, 25 Feb 2010)
@@ -1,41 +1,35 @@
 //////////////////////////////////////////////////////////////////////////////
-// assign::ref_list_of.hpp //
+// assign::auto_size::ref_rebind_list_of.hpp //
 // //
 // (C) Copyright 2010 Erwann Rogard //
 // Use, modification and distribution are subject to the //
 // 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_AUTO_SIZE_REF_LIST_OF_ER_2010_HPP
-#define BOOST_ASSIGN_AUTO_SIZE_REF_LIST_OF_ER_2010_HPP
+#ifndef BOOST_ASSIGN_AUTO_SIZE_REF_REBIND_LIST_OF_ER_2010_HPP
+#define BOOST_ASSIGN_AUTO_SIZE_REF_REBIND_LIST_OF_ER_2010_HPP
 #include <boost/assign/auto_size/detail/auto_size.hpp>
 
-// Usage 1:
-// std::vector<T> elems = cref_list_of(a)(b)(c);
-// Usage 2:
-// boost::array<T,3> elems = cref_list_of(a)(b)(c);
-// Usage 3:
-// BOOST_AUTO(tmp,ref_list_of(a)(b)(c)); boost::fill(tmp,d);
-//
-// This function has the same side effect as ref_list_of<int>(), but supersedes
-// it as it deduces the number of elements, here 3, from the arguments.
-//
-// Usage 3 binds d to a, b, c. Unless this specific feature is needed, function
-// ref_copy_list_of() is more straightforward.
+// This function supersedes ref_list_of<int>() as it deduces the number of
+// elements, from the arguments. The infix 'rebind' emphasizes that if the
+// result if on the lhs of an assignement such as,
+// boost::fill(ref_rebind_list_of(a)(b)(c),d)
+// the elements, here a, b and c, are bound to d. Unless this specific feature
+// is required, it is more straightforward to use ref_list_of().
 
 namespace boost{
 namespace assign{
 
     template<typename T>
     typename detail::auto_size::rebind_first<const T>::type
- cref_list_of(const T& t){
+ cref_rebind_list_of(const T& t){
         typedef typename detail::auto_size::rebind_first<const T>::type expr_;
         return expr_(t);
     }
 
     template<typename T>
     typename detail::auto_size::rebind_first<T>::type
- ref_list_of(T& t){
+ ref_rebind_list_of(T& t){
         typedef typename detail::auto_size::rebind_first<T>::type expr_;
         return expr_(t);
     }

Modified: sandbox/statistics/detail/assign/libs/assign/doc/cref_list_of2_speed.txt
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/doc/cref_list_of2_speed.txt (original)
+++ sandbox/statistics/detail/assign/libs/assign/doc/cref_list_of2_speed.txt 2010-02-25 09:08:31 EST (Thu, 25 Feb 2010)
@@ -1,26 +1,26 @@
 Output from cref_list_of2_speed.h for n = 1000 * 1000
 Mac OS Leopard 10.6 - x86_64 - Release mode - gcc 4.2
 
-cref_copy_list_of(1) => 0.01 s
+cref_list_of(1) => 0.01 s
 
 cref_list_of<>(1) => 0.01 s
 
-cref_copy_list_of(3) => 0.03 s
+cref_list_of(3) => 0.03 s
 
 cref_list_of<>(3) => 0.01 s
 
-cref_copy_list_of(10) => 0.09 s
+cref_list_of(10) => 0.09 s
 
 cref_list_of<>(10) => 0.05 s
 
-cref_copy_list_of(30) => 0.30 s
+cref_list_of(30) => 0.30 s
 
 cref_list_of<>(30) => 0.22 s
 
-cref_copy_list_of(80) => 0.87 s
+cref_list_of(80) => 0.87 s
 
 cref_list_of<>(80) => 0.49 s
 
-cref_copy_list_of(160) => 2.05 s
+cref_list_of(160) => 2.05 s
 
 cref_list_of<>(160) => 0.97 s
\ No newline at end of file

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-25 09:08:31 EST (Thu, 25 Feb 2010)
@@ -10,8 +10,8 @@
 #include <vector>
 #include <algorithm>
 #include <boost/typeof/typeof.hpp>
+#include <boost/assign/auto_size/ref_rebind_list_of.hpp>
 #include <boost/assign/auto_size/ref_list_of.hpp>
-#include <boost/assign/auto_size/ref_copy_list_of.hpp>
 #include <boost/assign/list_of.hpp>
 #include <libs/assign/example/cref_list_of2.h>
 
@@ -59,12 +59,12 @@
         
                 // cref_copy_list_of
             ints.clear();
- ints = cref_copy_list_of(a)(b)(3);
+ ints = cref_list_of(a)(b)(3);
                 BOOST_ASSERT(ints[0] == a);
                 BOOST_ASSERT(ints[1] == b);
                 BOOST_ASSERT(ints[2] == c);
         array = array0;
- array = cref_copy_list_of(a)(b)(3);
+ array = cref_list_of(a)(b)(3);
                 BOOST_ASSERT(array[0] == a);
                 BOOST_ASSERT(array[1] == b);
                 BOOST_ASSERT(array[2] == c);
@@ -72,7 +72,7 @@
                     ints.clear();
                 BOOST_AUTO(
                         tmp,
- cref_copy_list_of(a)(b)(3)
+ cref_list_of(a)(b)(3)
                 );
                 ints = ints_(boost::begin(tmp),boost::end(tmp));
                         BOOST_ASSERT(ints[0] == a);
@@ -86,7 +86,7 @@
                     ints.clear();
                 BOOST_AUTO(
                 tmp,
- cref_list_of(a)(b)(c)
+ cref_rebind_list_of(a)(b)(c)
             );
             {
                         ints = tmp;

Modified: sandbox/statistics/detail/assign/libs/assign/test/cref_list_of2_speed.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/test/cref_list_of2_speed.cpp (original)
+++ sandbox/statistics/detail/assign/libs/assign/test/cref_list_of2_speed.cpp 2010-02-25 09:08:31 EST (Thu, 25 Feb 2010)
@@ -9,7 +9,7 @@
 #include <boost/progress.hpp>
 #include <boost/bind.hpp>
 #include <boost/typeof/typeof.hpp>
-#include <boost/assign/auto_size/ref_copy_list_of.hpp>
+#include <boost/assign/auto_size/ref_list_of.hpp>
 #include <libs/assign/test/cref_list_of2_speed.h>
 
 // This file was provided by M.P.G
@@ -58,12 +58,12 @@
             timer_ timer;
             for(int i = 0; i < n; ++i)
             {
- BOOST_AUTO(rng, boost::assign::cref_copy_list_of(v[0]));
+ BOOST_AUTO(rng, boost::assign::cref_list_of(v[0]));
                 int sz = (int)rng.size();
                 if(sz != N)
                     os << "ERROR\n";
             }
- os << "cref_copy_list_of(" << N << ") => ";
+ os << "cref_list_of(" << N << ") => ";
         }
         {
                          timer_ timer;
@@ -84,12 +84,12 @@
                          timer_ timer;
             for(int i = 0; i < n; ++i)
             {
- BOOST_AUTO(rng, boost::assign::cref_copy_list_of(v[0])(v[1])(v[2]));
+ BOOST_AUTO(rng, boost::assign::cref_list_of(v[0])(v[1])(v[2]));
                 int sz = (int)rng.size();
                 if(sz != N)
                     os << "ERROR\n";
             }
- os << "cref_copy_list_of(" << N << ") => ";
+ os << "cref_list_of(" << N << ") => ";
         }
         {
                          timer_ timer;
@@ -111,12 +111,12 @@
                          timer_ timer;
             for(int i = 0; i < n; ++i)
             {
- BOOST_AUTO(rng, boost::assign::cref_copy_list_of(v[0])(v[1])(v[2])(v[3])(v[4])(v[5])(v[6])(v[7])(v[8])(v[9]));
+ BOOST_AUTO(rng, boost::assign::cref_list_of(v[0])(v[1])(v[2])(v[3])(v[4])(v[5])(v[6])(v[7])(v[8])(v[9]));
                 int sz = (int)rng.size();
                 if(sz != N)
                     os << "ERROR\n";
             }
- os << "cref_copy_list_of(" << N << ") => ";
+ os << "cref_list_of(" << N << ") => ";
         }
         {
                          timer_ timer;
@@ -138,14 +138,14 @@
                          timer_ timer;
             for(int i = 0; i < n; ++i)
             {
- BOOST_AUTO(rng, boost::assign::cref_copy_list_of(v[0])(v[1])(v[2])(v[3])(v[4])(v[5])(v[6])(v[7])(v[8])(v[9])
+ BOOST_AUTO(rng, boost::assign::cref_list_of(v[0])(v[1])(v[2])(v[3])(v[4])(v[5])(v[6])(v[7])(v[8])(v[9])
                            (v[10])(v[11])(v[12])(v[13])(v[14])(v[15])(v[16])(v[17])(v[18])(v[19])
                            (v[20])(v[21])(v[22])(v[23])(v[24])(v[25])(v[26])(v[27])(v[28])(v[29]));
                 int sz = (int)rng.size();
                 if(sz != N)
                     os << "ERROR\n";
             }
- os << "cref_copy_list_of(" << N << ") => ";
+ os << "cref_list_of(" << N << ") => ";
         }
         {
                          timer_ timer;
@@ -169,7 +169,7 @@
             timer_ timer;
             for(int i = 0; i < n; ++i)
             {
- BOOST_AUTO(rng, boost::assign::cref_copy_list_of( v[0])( v[1])( v[2])( v[3])( v[4])( v[5])( v[6])( v[7])( v[8])( v[9])
+ BOOST_AUTO(rng, boost::assign::cref_list_of( v[0])( v[1])( v[2])( v[3])( v[4])( v[5])( v[6])( v[7])( v[8])( v[9])
                            (v[10])(v[11])(v[12])(v[13])(v[14])(v[15])(v[16])(v[17])(v[18])(v[19])
                            (v[20])(v[21])(v[22])(v[23])(v[24])(v[25])(v[26])(v[27])(v[28])(v[29])
                            (v[30])(v[31])(v[32])(v[33])(v[34])(v[35])(v[36])(v[37])(v[38])(v[39])
@@ -181,7 +181,7 @@
                 if(sz != N)
                     os << "ERROR\n";
             }
- os << "cref_copy_list_of(" << N << ") => ";
+ os << "cref_list_of(" << N << ") => ";
         }
         {
                          timer_ timer;
@@ -210,7 +210,7 @@
                          timer_ timer;
             for(int i = 0; i < n; ++i)
             {
- BOOST_AUTO(rng, boost::assign::cref_copy_list_of( v[0])( v[1])( v[2])( v[3])( v[4])( v[5])( v[6])( v[7])( v[8])( v[9])
+ BOOST_AUTO(rng, boost::assign::cref_list_of( v[0])( v[1])( v[2])( v[3])( v[4])( v[5])( v[6])( v[7])( v[8])( v[9])
                            (v[10])(v[11])(v[12])(v[13])(v[14])(v[15])(v[16])(v[17])(v[18])(v[19])
                            (v[20])(v[21])(v[22])(v[23])(v[24])(v[25])(v[26])(v[27])(v[28])(v[29])
                            (v[30])(v[31])(v[32])(v[33])(v[34])(v[35])(v[36])(v[37])(v[38])(v[39])
@@ -230,7 +230,7 @@
                 if(sz != N)
                     os << "ERROR\n";
             }
- os << "cref_copy_list_of(" << N << ") => ";
+ os << "cref_list_of(" << N << ") => ";
         }
         {
                          timer_ timer;

Modified: sandbox/statistics/detail/assign/libs/assign/test/static_list_of_auto_size.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/test/static_list_of_auto_size.cpp (original)
+++ sandbox/statistics/detail/assign/libs/assign/test/static_list_of_auto_size.cpp 2010-02-25 09:08:31 EST (Thu, 25 Feb 2010)
@@ -21,7 +21,7 @@
 
 #include <algorithm>
 #include <iostream>
-#include <boost/assign/auto_size/ref_copy_list_of.hpp>
+#include <boost/assign/auto_size/ref_list_of.hpp>
 #include <boost/array.hpp>
 #include <boost/test/test_tools.hpp>
 
@@ -69,26 +69,26 @@
 {
     using namespace boost::assign;
     
- BOOST_CHECK( cref_copy_list_of( 1 )( 2 )( 3 )( 4 ).size() == 4 );
+ BOOST_CHECK( cref_list_of( 1 )( 2 )( 3 )( 4 ).size() == 4 );
     
     int a=1,b=5,c=3,d=4,e=2,f=9,g=0,h=7;
 
- int& max = *max_element( ref_copy_list_of(a)(b)(c)(d)(e)(f)(g)(h) );
+ int& max = *max_element( ref_list_of(a)(b)(c)(d)(e)(f)(g)(h) );
     BOOST_CHECK_EQUAL( max, f );
     max = 8;
     BOOST_CHECK_EQUAL( f, 8 );
- const int& const_max = *max_element( cref_copy_list_of(a)(b)(c)(d)(e)(f)(g)(h) );
+ const int& const_max = *max_element( cref_list_of(a)(b)(c)(d)(e)(f)(g)(h) );
     BOOST_CHECK_EQUAL( max, const_max );
 
- print( ref_copy_list_of(a)(b)(c)(d)(e)(f)(g)(h) );
- print( cref_copy_list_of(a)(b)(c)(d)(e)(f)(g)(h) );
+ print( ref_list_of(a)(b)(c)(d)(e)(f)(g)(h) );
+ print( cref_list_of(a)(b)(c)(d)(e)(f)(g)(h) );
 
- boost::array<int,4> array = cref_copy_list_of(1)(2)(3)(4);
+ boost::array<int,4> array = cref_list_of(1)(2)(3)(4);
 
     BOOST_CHECK_EQUAL( array[0], 1 );
     BOOST_CHECK_EQUAL( array[3], 4 );
     //
- //print( cref_copy_list_of( "foo" )( "bar" )( "foobar" ) );
+ //print( cref_list_of( "foo" )( "bar" )( "foobar" ) );
     //
 }
 


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