|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59965 - in sandbox/statistics/detail/assign: boost/assign/auto_size boost/assign/auto_size/detail libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-02-27 18:49:07
Author: e_r
Date: 2010-02-27 18:49:06 EST (Sat, 27 Feb 2010)
New Revision: 59965
URL: http://svn.boost.org/trac/boost/changeset/59965
Log:
m
Text files modified:
sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp | 18 ++++++++++++------
sandbox/statistics/detail/assign/boost/assign/auto_size/detail/csv.hpp | 11 ++++++-----
sandbox/statistics/detail/assign/boost/assign/auto_size/ref_list_of.hpp | 20 +++-----------------
sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp | 4 ++--
4 files changed, 23 insertions(+), 30 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-27 18:49:06 EST (Sat, 27 Feb 2010)
@@ -181,19 +181,25 @@
);
}
+ // This needs to be exposed for csv.
+ const D& allocated()const{
+ this->alloc_if();
+ return static_cast<const D&>(*this);
+ }
+
private:
- void alloc()const{
- this->ptr = smart_ptr_(new ref_array_);
- write_to_array(*this->ptr,static_cast<const D&>(*this));
- }
-
void alloc_if()const{
if(!this->ptr){
- return this->alloc();
+ return this->alloc();
}
}
+ void alloc()const{
+ this->ptr = smart_ptr_(new ref_array_);
+ write_to_array(*this->ptr,static_cast<const D&>(*this));
+ }
+
protected:
ref_array_& ref_array(){
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-27 18:49:06 EST (Sat, 27 Feb 2010)
@@ -16,17 +16,18 @@
// Warning : currently buggy
-#define BOOST_ASSIGN_LIST_OF_CSV_tmp(z,n,unused) (BOOST_PP_CAT(_,n))
-#define BOOST_ASSIGN_LIST_OF_CSV_rec(fun,N) \
- boost::assign::fun BOOST_PP_ENUM(N,BOOST_ASSIGN_LIST_OF_CSV_tmp,~) \
+#define BOOST_ASSIGN_CSV_ARG(z,n,arg) (BOOST_PP_CAT(arg,n))
+#define BOOST_ASSIGN_CSV_CALL(fun,N) \
+ boost::assign::fun BOOST_PP_ENUM(N,BOOST_ASSIGN_CSV_ARG,~) \
/**/
-#define BOOST_ASSIGN_LIST_OF_CSV_ITER(fun,N) \
+#define BOOST_ASSIGN_CSV_ITER(fun,N) \
namespace boost{ \
namespace assign{ \
template<typename T> \
typename assign::detail::auto_size::result_of_copy<const T,N>::type \
fun(BOOST_PP_ENUM_PARAMS(N, const T& _)){ \
- return BOOST_ASSIGN_LIST_OF_CSV_rec(fun,N); \
+ return (boost::assign::fun \
+ BOOST_PP_REPEAT(N,BOOST_ASSIGN_CSV_ARG,_)).allocated(); \
} \
} \
} \
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-27 18:49:06 EST (Sat, 27 Feb 2010)
@@ -8,13 +8,14 @@
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_ASSIGN_AUTO_SIZE_REF_LIST_OF_ER_2010_HPP
#define BOOST_ASSIGN_AUTO_SIZE_REF_LIST_OF_ER_2010_HPP
+#include <boost/typeof/typeof.hpp> // templatetmp.
#include <boost/assign/auto_size/detail/auto_size.hpp>
#include <boost/assign/auto_size/detail/csv.hpp>
// Creates a collection of references exposing the boost::array interface and
// 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)
+// boost::fill(ref_list_of(a,b,c),0)
// This function supersedes ref_list_of<int>().
namespace boost{
@@ -32,24 +33,9 @@
return detail::auto_size::first_copy<T>::call(t);
}
- // Temporary manual overloads. A is MACRO needed. See csv.hpp
-
- template<typename T>
- typename assign::detail::auto_size::result_of_copy<const T,2>::type
- cref_list_of(const T& a,const T& b){
- return cref_list_of(a)(b);
- }
-
- template<typename T>
- typename assign::detail::auto_size::result_of_copy<const T,3>::type
- cref_list_of(const T& a,const T& b,const T& c){
- return cref_list_of(a)(b)(c);
- }
-
-
}// assign
}// boost
-//BOOST_ASSIGN_LIST_OF_CSV_ITER(cref_list_of,3)
+BOOST_ASSIGN_CSV_ITER(cref_list_of,3)
#endif
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-27 18:49:06 EST (Sat, 27 Feb 2010)
@@ -44,8 +44,8 @@
{
// BUG
res_ res = cref_list_of(a,b,c);
- BOOST_ASSERT(res[0] != a); //wrong
- BOOST_ASSERT(res[1] != b); //wrong
+ BOOST_ASSERT(res[0] == a); //wrong
+ BOOST_ASSERT(res[1] == b); //wrong
BOOST_ASSERT(res[2] == c); //correct
}
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