Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60002 - in sandbox/statistics/detail/assign: boost/assign/auto_size boost/assign/auto_size/detail boost/assign/auto_size/detail/policy libs/assign/doc libs/assign/example libs/assign/src libs/assign/test
From: erwann.rogard_at_[hidden]
Date: 2010-02-28 16:27:41


Author: e_r
Date: 2010-02-28 16:27:39 EST (Sun, 28 Feb 2010)
New Revision: 60002
URL: http://svn.boost.org/trac/boost/changeset/60002

Log:
m
Added:
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/has_copy_semantics.hpp (contents, props changed)
   sandbox/statistics/detail/assign/boost/assign/auto_size/ref_list_of_csv.hpp (contents, props changed)
   sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of_csv.hpp (contents, props changed)
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/array_wrapper.hpp | 20 +++++++++++++++-----
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp | 17 +++++++++++++++++
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/csv.hpp | 18 +++++++++++++-----
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy/array.hpp | 8 --------
   sandbox/statistics/detail/assign/boost/assign/auto_size/ref_list_of.hpp | 7 -------
   sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of.hpp | 8 +-------
   sandbox/statistics/detail/assign/libs/assign/doc/speed_csv.txt | 18 +++++++++---------
   sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp | 7 +++++--
   sandbox/statistics/detail/assign/libs/assign/src/main.cpp | 4 ++--
   sandbox/statistics/detail/assign/libs/assign/test/speed_csv.cpp | 2 +-
   10 files changed, 63 insertions(+), 46 deletions(-)

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/array_wrapper.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/array_wrapper.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/array_wrapper.hpp 2010-02-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -10,6 +10,7 @@
 #define BOOST_ASSIGN_AUTO_SIZE_DETAIL_ARRAY_WRAPPER_ER_2010_HPP
 #include <boost/shared_ptr.hpp>
 #include <boost/assign/auto_size/detail/array_interface.hpp>
+#include <boost/assign/auto_size/detail/auto_size.hpp>
 
 namespace boost{
 namespace assign{
@@ -27,19 +28,28 @@
                 
         public:
 
- array_wrapper(smart_ptr_ arg)
- :ptr(arg){}
+// array_wrapper(smart_ptr_ arg)
+// :ptr(arg){}
+
+ array_wrapper(){}
                 
         ref_array_& ref_array_impl(){
- return (*this->ptr);
+ return this->ref_array;
         }
 
         const ref_array_& ref_array_impl()const{
- return (*this->ptr);
+ return this->ref_array;
+ }
+
+ template<typename E>
+ void initialize(const E& coll)const{
+ write_to_array(this->ref_array,coll);
         }
         
         private:
- mutable smart_ptr_ ptr;
+ //mutable smart_ptr_ ptr;
+
+ mutable ref_array_ ref_array;
 
     };
 

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-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -75,6 +75,8 @@
             };
     };
 
+ struct no_policy{};
+
     template<
             typename E,typename T,int N,template<typename> class Ref,typename P
>
@@ -149,6 +151,21 @@
         static type call(T& a){ return type(top_(),a); }
     };
 
+ template<typename T,template<typename> class Ref>
+ struct first_expr_no_policy : first_expr<T,Ref,no_policy>{};
+
+ template<template<typename> class Ref,typename T>
+ typename first_expr_no_policy<T,Ref>::type
+ make_first_expr_no_policy(T& a){
+ return first_expr_no_policy<T,Ref>::call(a);
+ }
+
+ template<template<typename> class Ref,typename T>
+ typename first_expr_no_policy<const T,Ref>::type
+ make_first_expr_no_policy(const T& a){
+ return first_expr_no_policy<const T,Ref>::call(a);
+ }
+
     template<typename T,typename P = default_policy>
     struct first_copy : first_expr<T,ref_copy,P>{};
 

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/csv.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/csv.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/csv.hpp 2010-02-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -49,11 +49,19 @@
 namespace assign{ \
         template<typename T> \
     boost::assign::detail::auto_size::array_wrapper< \
- U,N,BOOST_ASSIGN_CSV_ref> \
- BOOST_PP_CAT(F,_csv)(BOOST_PP_ENUM_PARAMS(N, U& _)){ \
- return ( \
- boost::assign::F BOOST_PP_REPEAT(N,BOOST_ASSIGN_CSV_ARG,_) \
- ).wrapper(); \
+ U,N,BOOST_ASSIGN_CSV_ref \
+ > \
+ F(BOOST_PP_ENUM_PARAMS(N, U& _)) \
+ { \
+ typedef boost::assign::detail::auto_size::array_wrapper< \
+ U,N,BOOST_ASSIGN_CSV_ref> wrapper_; \
+ wrapper_ wrapper; \
+ wrapper.initialize( \
+ boost::assign::detail::auto_size::make_first_expr_no_policy< \
+ BOOST_ASSIGN_CSV_ref \
+ > BOOST_PP_REPEAT(N,BOOST_ASSIGN_CSV_ARG,_) \
+ ); \
+ return wrapper; \
     } \
 } \
 } \

Added: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/has_copy_semantics.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/has_copy_semantics.hpp 2010-02-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,30 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::has_copy_semantics.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_DETAIL_HAS_COPY_SEMANTICS_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_HAS_COPY_SEMANTICS_ER_2010_HPP
+#include <boost/mpl/bool.hpp>
+#include <boost/assign/auto_size/detail/assign_refence_copy.hpp>
+
+namespace boost{
+namespace assign{
+namespace detail{
+
+ template<typename T>
+ struct has_copy_semantics : boost::mpl::bool_<false>{};
+
+ template<typename T>
+ struct has_copy_semantics<assign_reference_copy<T> >
+ : boost::mpl::bool_<true>{};
+
+}// detail
+}// assign
+}// boost
+
+#endif
+

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy/array.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy/array.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy/array.hpp 2010-02-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -55,14 +55,6 @@
                 
         public:
 
- typedef array_wrapper<T,N,Ref> wrapper_;
-
- // Needed by csv.hpp
- wrapper_ wrapper()const{
- this->alloc_if();
- return wrapper_(this->ptr);
- }
-
         ref_array_& ref_array_impl(){
             this->alloc_if();
             return (*this->ptr);

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-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -16,7 +16,6 @@
 // convertible to a range that is constructible from a pair of iterators. It can
 // be used either as the rhs or lhs of an assignment such as:
 // boost::fill(ref_list_of(a)(b)(c),0)
-// This function supersedes ref_list_of<int>().
 
 namespace boost{
 namespace assign{
@@ -36,10 +35,4 @@
 }// assign
 }// boost
 
-// Adds csv support, e.g. ref_list_of_csv(a,b,c)
-#define BOOST_ASSIGN_CSV_ref boost::assign::detail::auto_size::ref_copy
-#include <boost/assign/auto_size/detail/csv.hpp>
-BOOST_ASSIGN_CSV(ref_list_of)
-#undef BOOST_ASSIGN_CSV_ref
-
 #endif

Added: sandbox/statistics/detail/assign/boost/assign/auto_size/ref_list_of_csv.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/ref_list_of_csv.hpp 2010-02-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,21 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::ref_list_of_csv.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_CSV_ER_2010_HPP
+#define BOOST_ASSIGN_AUTO_SIZE_REF_LIST_OF_CSV_ER_2010_HPP
+#include <boost/typeof/typeof.hpp> // tmp.
+#include <boost/assign/auto_size/detail/auto_size.hpp>
+#include <boost/assign/auto_size/detail/array_wrapper.hpp>
+
+
+#define BOOST_ASSIGN_CSV_ref boost::assign::detail::auto_size::ref_copy
+#include <boost/assign/auto_size/detail/csv.hpp>
+BOOST_ASSIGN_CSV(ref_list_of_csv)
+#undef BOOST_ASSIGN_CSV_ref
+
+#endif

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-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -13,9 +13,8 @@
 // Creates a collection of references exposing the boost::array interface and
 // convertible to a range that is constructible from a pair of iterators. Rebind
 // semantics apply if the collection is the lhs of an assignment:
-// cref_rebind_list_of(a,b,c).assign(d)
+// cref_rebind_list_of(a)(b(c).assign(d)
 // Unless this specific feature is needed, ref_list_of() is preferable.
-// Note that this function supersedes ref_list_of<int>().
 
 namespace boost{
 namespace assign{
@@ -35,10 +34,5 @@
 }// assign
 }// boost
 
-// Adds csv support, e.g. ref_rebind_list_of_csv(a,b,c)
-#define BOOST_ASSIGN_CSV_ref boost::assign::detail::auto_size::ref_rebind
-#include <boost/assign/auto_size/detail/csv.hpp>
-BOOST_ASSIGN_CSV(ref_rebind_list_of)
-#undef BOOST_ASSIGN_CSV_ref
 
 #endif

Added: sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of_csv.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of_csv.hpp 2010-02-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,20 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::ref_rebind_list_of_csv.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_REBIND_LIST_OF_CSV_ER_2010_HPP
+#define BOOST_ASSIGN_AUTO_SIZE_REF_REBIND_LIST_OF_CSV_ER_2010_HPP
+#include <boost/typeof/typeof.hpp> // tmp.
+#include <boost/assign/auto_size/detail/auto_size.hpp>
+#include <boost/assign/auto_size/detail/array_wrapper.hpp>
+
+#define BOOST_ASSIGN_CSV_ref boost::assign::detail::auto_size::ref_rebind
+#include <boost/assign/auto_size/detail/csv.hpp>
+BOOST_ASSIGN_CSV(ref_rebind_list_of_csv)
+#undef BOOST_ASSIGN_CSV_ref
+
+#endif

Modified: sandbox/statistics/detail/assign/libs/assign/doc/speed_csv.txt
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/doc/speed_csv.txt (original)
+++ sandbox/statistics/detail/assign/libs/assign/doc/speed_csv.txt 2010-02-28 16:27:39 EST (Sun, 28 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_list_of(1) => 0.01 s
+cref_list_of_csv(1) => 0.02 s
 
 cref_list_of<>(1) => 0.01 s
 
-cref_list_of(3) => 0.40 s
+cref_list_of_csv(3) => 0.05 s
 
 cref_list_of<>(3) => 0.01 s
 
-cref_list_of(10) => 0.63 s
+cref_list_of_csv(10) => 0.19 s
 
-cref_list_of<>(10) => 0.06 s
+cref_list_of<>(10) => 0.05 s
 
-cref_list_of(30) => 0.93 s
+cref_list_of_csv(30) => 0.64 s
 
 cref_list_of<>(30) => 0.21 s
 
-cref_list_of(80) => 2.73 s
+cref_list_of_csv(80) => 1.77 s
 
-cref_list_of<>(80) => 0.47 s
+cref_list_of<>(80) => 0.50 s
 
-cref_list_of(160) => 9.28 s
+cref_list_of_csv(160) => 7.52 s
 
-cref_list_of<>(160) => 0.93 s
\ No newline at end of file
+cref_list_of<>(160) => 0.97 s

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-02-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -10,8 +10,10 @@
 #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_rebind_list_of.hpp>
+//#include <boost/assign/auto_size/ref_list_of.hpp>
+#include <boost/assign/auto_size/ref_list_of_csv.hpp>
+#include <boost/assign/auto_size/ref_rebind_list_of_csv.hpp>
 #include <boost/assign/auto_size/detail/array_wrapper.hpp>
 
 #include <boost/assign/list_of.hpp>
@@ -82,6 +84,7 @@
             }
         }
     }
+
     os << "<- " << std::endl;
     
 };

Modified: sandbox/statistics/detail/assign/libs/assign/src/main.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/src/main.cpp (original)
+++ sandbox/statistics/detail/assign/libs/assign/src/main.cpp 2010-02-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -1,6 +1,6 @@
 #include <iostream>
 #include <libs/assign/example/ref_list_of.h>
-#include <libs/assign/test/speed.h>
+//#include <libs/assign/test/speed.h>
 #include <libs/assign/test/speed_csv.h>
 //#include <libs/assign/test/static_list_of_auto_size.h>
 
@@ -8,7 +8,7 @@
 
         example_ref_list_of(std::cout);
         //test_speed(std::cout);
- test_speed_csv(std::cout);
+ test_speed_csv(std::cout);
 // check_static_list_of_auto_size();
 
         return 0;

Modified: sandbox/statistics/detail/assign/libs/assign/test/speed_csv.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/test/speed_csv.cpp (original)
+++ sandbox/statistics/detail/assign/libs/assign/test/speed_csv.cpp 2010-02-28 16:27:39 EST (Sun, 28 Feb 2010)
@@ -12,7 +12,7 @@
 #include <libs/assign/test/speed_common.h>
 
 #define BOOST_ASSIGN_CSV_SIZE 160
-#include <boost/assign/auto_size/ref_list_of.hpp>
+#include <boost/assign/auto_size/ref_list_of_csv.hpp>
 #undef BOOST_ASSIGN_CSV_SIZE
 
 #include <libs/assign/test/speed.h>


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