Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59999 - in sandbox/statistics/detail/assign: boost/assign/auto_size/detail boost/assign/auto_size/detail/policy libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-02-28 15:05:57


Author: e_r
Date: 2010-02-28 15:05:56 EST (Sun, 28 Feb 2010)
New Revision: 59999
URL: http://svn.boost.org/trac/boost/changeset/59999

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/array_interface.hpp | 21 +++++++++++++++++----
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/array_wrapper.hpp | 1 +
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy/array.hpp | 4 +---
   sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp | 1 +
   4 files changed, 20 insertions(+), 7 deletions(-)

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/array_interface.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/array_interface.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/array_interface.hpp 2010-02-28 15:05:56 EST (Sun, 28 Feb 2010)
@@ -9,8 +9,10 @@
 #ifndef BOOST_ASSIGN_AUTO_SIZE_DETAIL_ARRAY_INTERFACE_ER_2010_HPP
 #define BOOST_ASSIGN_AUTO_SIZE_DETAIL_ARRAY_INTERFACE_ER_2010_HPP
 #include <algorithm>
+#include <boost/mpl/bool.hpp>
 #include <boost/array.hpp>
 #include <boost/range.hpp>
+#include <boost/assign/auto_size/detail/has_copy_semantics.hpp>
 
 namespace boost{
 namespace assign{
@@ -86,10 +88,8 @@
         
         void swap(ref_array_& other){ return (this->ref_array()).swap(other); }
         void assign(const T& val){
- // Force copy semantics. Suggested by M.P.G on Feb 28th, 2010.
-// ref_array_& ra = this->ref_array();
-// std::fill(ra.begin(), ra.end(), val);
- return this->ref_array().assign(val);
+ typedef has_copy_semantics<ref_> pred_;
+ return this->assign(val,pred_());
         }
 
         template<typename T1>
@@ -113,6 +113,19 @@
         }
 
         private:
+ typedef boost::mpl::bool_<false> false_;
+ typedef boost::mpl::bool_<true> true_;
+
+ void assign(const T& val,true_ /*copy semantics*/){
+ // Force copy semantics. Suggested by M.P.G on Feb 28th, 2010.
+ ref_array_& ra = this->ref_array();
+ std::fill(ra.begin(), ra.end(), val);
+ }
+
+ void assign(const T& val,false_ /*copy semantics*/){
+ // Force copy semantics. Suggested by M.P.G on Feb 28th, 2010.
+ return this->ref_array().assign(val);
+ }
                 
         ref_array_& ref_array(){
                         return static_cast<D&>(*this).ref_array_impl();

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 15:05:56 EST (Sun, 28 Feb 2010)
@@ -16,6 +16,7 @@
 namespace detail{
 namespace auto_size{
  
+ // Exposes the boost::array interface. This is needed for csv support.
     template<typename T,int N,template<typename> class Ref>
     class array_wrapper
             : public array_interface<T,N,Ref,array_wrapper<T,N,Ref> >

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 15:05:56 EST (Sun, 28 Feb 2010)
@@ -18,9 +18,7 @@
 namespace auto_size{
  
     template<
- typename E,typename T,int N,
- template<typename> class Ref,
- typename P
+ typename E,typename T,int N,template<typename> class Ref,typename P
>
     class expr;
 

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 15:05:56 EST (Sun, 28 Feb 2010)
@@ -52,6 +52,7 @@
         {
             BOOST_AUTO(tmp,ref_list_of_csv(a,b,c));
             std::fill(boost::begin(tmp),boost::end(tmp),0);
+ tmp.assign(0);
             BOOST_ASSERT(a == 0);
             BOOST_ASSERT(b == 0);
             BOOST_ASSERT(c == 0);


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