Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69997 - in sandbox/assign_v2: boost/assign/v2/utility boost/assign/v2/utility/csv libs/assign/v2/src libs/assign/v2/test libs/assign/v2/test/put libs/assign/v2/test/utility
From: erwann.rogard_at_[hidden]
Date: 2011-03-14 21:56:31


Author: e_r
Date: 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
New Revision: 69997
URL: http://svn.boost.org/trac/boost/changeset/69997

Log:
upd assign_v2
Text files modified:
   sandbox/assign_v2/boost/assign/v2/utility/csv.hpp | 122 +++++++++++++++++++++++++++++++++++++++
   sandbox/assign_v2/boost/assign/v2/utility/csv/make.hpp | 94 ------------------------------
   sandbox/assign_v2/boost/assign/v2/utility/csv/result.hpp | 60 -------------------
   sandbox/assign_v2/libs/assign/v2/src/main.cpp | 8 +-
   sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp | 23 +++---
   sandbox/assign_v2/libs/assign/v2/test/utility.cpp | 5
   sandbox/assign_v2/libs/assign/v2/test/utility/chain.cpp | 23 +++---
   sandbox/assign_v2/libs/assign/v2/test/utility/chain.h | 2
   sandbox/assign_v2/libs/assign/v2/test/utility/conversion.h | 2
   sandbox/assign_v2/libs/assign/v2/test/utility/csv.cpp | 4
   sandbox/assign_v2/libs/assign/v2/test/utility/csv.h | 2
   11 files changed, 158 insertions(+), 187 deletions(-)

Modified: sandbox/assign_v2/boost/assign/v2/utility/csv.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/csv.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/csv.hpp 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -9,8 +9,126 @@
 //////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_ASSIGN_V2_UTILITY_CSV_ER_2010_HPP
 #define BOOST_ASSIGN_V2_UTILITY_CSV_ER_2010_HPP
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+#include <boost/assign/v2/detail/pp/ignore.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/vector.hpp>
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <utility>
+#include <boost/assign/v2/temporary/variadic_vector.hpp>
+#else
+#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repetition.hpp>
+#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
 
-#include <boost/assign/v2/utility/csv/make.hpp>
-#include <boost/assign/v2/utility/csv/result.hpp>
+namespace boost{
+namespace assign{
+namespace v2{
+namespace csv_aux{
+
+ template<typename F, typename T>
+ struct unary_result
+ {
+ static F f;
+ static T t;
+ typedef BOOST_TYPEOF_TPL( f( t ) ) type;
+ };
+
+ template<typename F>
+ struct result
+ {
+
+ typedef F state_;
+
+ template<typename Vec>
+ struct apply : ::boost::mpl::fold<
+ Vec,
+ state_,
+ unary_result< ::boost::mpl::_1, ::boost::mpl::_2>
+ >{};
+
+ };
+
+}// csv_aux
+//[syntax_utility_csv
+namespace result_of{
+
+ template<typename F, typename V>
+ struct csv /*<-*/: ::boost::mpl::apply1<
+ csv_aux::result<F>,
+ V
+ >{}/*->*/;
+
+}// nth_result_of
+//->
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+//<-
+
+ template<typename F, typename T>
+ typename result_of::csv<F const&,
+ ::boost::mpl::vector<T>
+ >::type
+ csv( F const& functor, T&& t )/*<-*/
+ {
+ return functor( t );
+ }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ template<typename F, typename T, typename... Args>
+ typename result_of::csv<F const&,
+ typename ::boost::mpl::detail::variadic_vector<T, Args...>::type
+ >::type
+ csv( F const& functor, T&& t, Args&&... args )/*<-*/
+ {
+ return csv( functor( t ), std::forward<Args>( args )... );
+ }BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
+
+#else
+#define BOOST_ASSIGN_V2_MACRO1(z, i, data) BOOST_PP_CAT(T, i) data
+#define BOOST_ASSIGN_V2_MACRO2(z, i, data) ( BOOST_PP_CAT(_, i) )
+#define BOOST_ASSIGN_V2_MACRO3(z, N, data)\
+\
+ template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)>\
+ typename result_of::csv<F const&, \
+ ::boost::mpl::vector<BOOST_PP_ENUM(N, BOOST_ASSIGN_V2_MACRO1, &)>\
+ >::type\
+ csv( \
+ F const& functor\
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, T, & _)\
+ )\
+ {\
+ return functor BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO2, ~ );\
+ }\
+\
+ template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)>\
+ typename result_of::csv<F const&,\
+ ::boost::mpl::vector<BOOST_PP_ENUM(N, BOOST_ASSIGN_V2_MACRO1, const &)>\
+ >::type\
+ csv( \
+ F const& functor\
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, T, const & _)\
+ )\
+ {\
+ return functor BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO2, ~ );\
+ }\
+\
+/**/
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO3,
+ ~
+)
+#undef BOOST_ASSIGN_V2_MACRO1
+#undef BOOST_ASSIGN_V2_MACRO2
+#undef BOOST_ASSIGN_V2_MACRO3
+#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
+
+}// v2
+}// assign
+}// boost
 
 #endif // BOOST_ASSIGN_V2_UTILITY_CSV_ER_2010_HPP

Modified: sandbox/assign_v2/boost/assign/v2/utility/csv/make.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/csv/make.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/csv/make.hpp 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -1,93 +1 @@
-//////////////////////////////////////////////////////////////////////////////
-// Boost.Assign v2 //
-// //
-// Copyright (C) 2003-2004 Thorsten Ottosen //
-// Copyright (C) 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_V2_UTILITY_CSV_MAKE_ER_2010_HPP
-#define BOOST_ASSIGN_V2_UTILITY_CSV_MAKE_ER_2010_HPP
-#include <boost/assign/v2/utility/csv/result.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
-#if BOOST_ASSIGN_V2_ENABLE_CPP0X
-#include <utility>
-#include <boost/assign/v2/temporary/variadic_vector.hpp>
-#else
-#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/repetition.hpp>
-#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
-
-namespace boost{
-namespace assign{
-namespace v2{
-
-#if BOOST_ASSIGN_V2_ENABLE_CPP0X
-
- template<typename F, typename T>
- typename result_of::csv<F const&,
- ::boost::mpl::vector<T>
- >::type
- csv( F const& functor, T&& t )
- {
- return functor( t );
- }
-
- template<typename F, typename T, typename... Args>
- typename result_of::csv<F const&,
- typename ::boost::mpl::detail::variadic_vector<T, Args...>::type
- >::type
- csv( F const& functor, T&& t, Args&&... args )
- {
- return csv( functor( t ), std::forward<Args>( args )... );
- }
-
-#else
-#define BOOST_ASSIGN_V2_MACRO1(z, i, data) BOOST_PP_CAT(T, i) data
-#define BOOST_ASSIGN_V2_MACRO2(z, i, data) ( BOOST_PP_CAT(_, i) )
-#define BOOST_ASSIGN_V2_MACRO3(z, N, data)\
-\
- template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)>\
- typename result_of::csv<F const&, \
- ::boost::mpl::vector<BOOST_PP_ENUM(N, BOOST_ASSIGN_V2_MACRO1, &)>\
- >::type\
- csv( \
- F const& functor\
- BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, T, & _)\
- )\
- {\
- return functor BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO2, ~ );\
- }\
-\
- template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)>\
- typename result_of::csv<F const&,\
- ::boost::mpl::vector<BOOST_PP_ENUM(N, BOOST_ASSIGN_V2_MACRO1, const &)>\
- >::type\
- csv( \
- F const& functor\
- BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, T, const & _)\
- )\
- {\
- return functor BOOST_PP_REPEAT(N, BOOST_ASSIGN_V2_MACRO2, ~ );\
- }\
-\
-/**/
-BOOST_PP_REPEAT_FROM_TO(
- 1,
- BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
- BOOST_ASSIGN_V2_MACRO3,
- ~
-)
-#undef BOOST_ASSIGN_V2_MACRO1
-#undef BOOST_ASSIGN_V2_MACRO2
-#undef BOOST_ASSIGN_V2_MACRO3
-#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
-
-}// v2
-}// assign
-}// boost
-
-#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
+// TODO remove file
\ No newline at end of file

Modified: sandbox/assign_v2/boost/assign/v2/utility/csv/result.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/utility/csv/result.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/utility/csv/result.hpp 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -1,59 +1 @@
-//////////////////////////////////////////////////////////////////////////////
-// Boost.Assign v2 //
-// //
-// Copyright (C) 2003-2004 Thorsten Ottosen //
-// Copyright (C) 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_V2_UTILITY_CSV_RESULT_ER_2010_HPP
-#define BOOST_ASSIGN_V2_UTILITY_CSV_RESULT_ER_2010_HPP
-#include <boost/typeof/typeof.hpp>
-#include <boost/mpl/apply.hpp>
-#include <boost/mpl/fold.hpp>
-#include <boost/mpl/placeholders.hpp>
-
-namespace boost{
-namespace assign{
-namespace v2{
-namespace csv_aux{
-
- template<typename F, typename T>
- struct unary_result
- {
- static F f;
- static T t;
- typedef BOOST_TYPEOF_TPL( f( t ) ) type;
- };
-
- template<typename F>
- struct result
- {
-
- typedef F state_;
-
- template<typename Vec>
- struct apply : ::boost::mpl::fold<
- Vec,
- state_,
- unary_result< ::boost::mpl::_1, ::boost::mpl::_2>
- >{};
-
- };
-
-}// csv_aux
-namespace result_of{
-
- template<typename F, typename V>
- struct csv : ::boost::mpl::apply1<
- csv_aux::result<F>,
- V
- >{};
-
-}// nth_result_of
-}// v2
-}// assign
-}// boost
-
-#endif // BOOST_ASSIGN_V2_UTILITY_CSV_RESULT_ER_2010_HPP
+// TODO remove file
\ No newline at end of file

Modified: sandbox/assign_v2/libs/assign/v2/src/main.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/src/main.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/src/main.cpp 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -3,8 +3,8 @@
 //#include <libs/assign/v2/test/detail.h>
 #include <libs/assign/v2/test/ref.h>
 //#include <libs/assign/v2/test/mix.h>
-//#include <libs/assign/v2/test/put.h>
-//#include <libs/assign/v2/test/utility.h>
+#include <libs/assign/v2/test/put.h>
+#include <libs/assign/v2/test/utility.h>
 
 // Speed
 //#include <fstream>
@@ -45,10 +45,10 @@
     }
     {
         using namespace test_assign_v2;
- //xxx_put::test();
+ xxx_put::test();
         //xxx_mix::test();
         xxx_ref::test();
- //xxx_utility::test();
+ xxx_utility::test();
     }
 
     /*

Modified: sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -31,34 +31,35 @@
 namespace xxx_put{
 namespace xxx_fun{
 
-#ifdef __llvm__
+#ifdef __llvm__
 
     struct f{
-
+
         typedef int result_type;
-
+
         template<typename T>
         result_type operator()(T const& i)const{ return i + 1; };
-
+
     };
-
+
     void test()
     {
+ using namespace boost;
         namespace as2 = assign::v2;
         {
             std::vector<int> incr;
             (
              as2::put( incr ) % ( as2::_fun = f() )
- )( 1 )( 2 )( 3 )( 4 )( 5 );
-
+ )( 1 )( 2 )( 3 )( 4 )( 5 );
+
             /*<-*/BOOST_ASSIGN_V2_CHECK( BOOST_ASSIGN_V2_IGNORE(/*->*/assert( /*<-*/))/*->*/incr.front() == ( 2 ) );
             /*<-*/BOOST_ASSIGN_V2_CHECK( BOOST_ASSIGN_V2_IGNORE(/*->*/assert( /*<-*/))/*->*/incr.back() == ( 6 ) );
             // TODO fix Bug :
             // LLVM 1.5 - Release mode, EXC_BAD_ACCESS, stl_vector.h #602
- }
-
+ }
+
     }
-
+
 #else
 
     void test()
@@ -72,7 +73,7 @@
             typedef function<double(double)> f_;
             (
                 as2::put( exponent ) % ( as2::_fun = f_( log10 ) )
- )/*<<Equivalent to `as2::put( exponent )( log10( 1000.0 ) )( log10( 10.0 ) )( log10( 10000.0 ) )( log10( 1.0 ) )( log10( 100.0 ) )`>>*/( 1000.0 )( 10.0 )( 10000.0 )( 1.0 )( 100.0 );
+ )/*<<Equivalent to `as2::put( exponent )( log10( 1000.0 ) )( log10( 10.0 ) )( log10( 10000.0 ) )( log10( 1.0 ) )( log10( 100.0 ) )`>>*/( 1000.0 )( 10.0 )( 10000.0 )( 1.0 )( 100.0 );
 
 
             double eps = numeric::bounds<double>::smallest();

Modified: sandbox/assign_v2/libs/assign/v2/test/utility.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/utility.cpp 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -8,8 +8,8 @@
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
 //////////////////////////////////////////////////////////////////////////////
 #include <libs/assign/v2/test/utility/chain.h>
-#include <libs/assign/v2/test/utility/csv.h>
 #include <libs/assign/v2/test/utility/conversion.h>
+#include <libs/assign/v2/test/utility/csv.h>
 #include <libs/assign/v2/test/utility.h>
 
 namespace test_assign_v2{
@@ -17,8 +17,9 @@
 
     void test()
     {
- //xxx_chain::test();
+ xxx_chain::test();
         xxx_conversion::test();
+ xxx_csv::test();
     }
 
 }// xxx_type_traits

Modified: sandbox/assign_v2/libs/assign/v2/test/utility/chain.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/chain.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/chain.cpp 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -16,6 +16,7 @@
 #include <boost/range/algorithm/copy.hpp>
 #include <boost/range/algorithm/equal.hpp>
 #include <boost/assign/v2/ref/array/csv_array.hpp>
+#include <boost/assign/v2/put/deque/csv_deque.hpp>
 #include <boost/assign/v2/utility/chain/check.hpp>
 #include <boost/assign/v2/utility/chain.hpp>
 #include <boost/assign/v2/utility/chain/operator_and.hpp>
@@ -40,32 +41,32 @@
             typedef std::string T;
             array<T, 2> head; head[0] = "A"; head[1] = "B";
             std::list<T> tail; tail.push_back( "C" ); tail.push_back( "D" );
- std::vector<T> joined( begin( head ), end( head ) ); copy( tail, std::back_inserter( joined ) );
+ std::vector<T> joined; copy( head | as2::_chain( tail ), std::back_inserter( joined ) );
 
             BOOST_ASSIGN_V2_CHECK(
- range::equal( joined, head | as2::_chain( tail ) )
+ range::equal( joined, as2::csv_deque<T>("A", "B", "C", "D") )
             );
             //]
         }
         {
             //[test_utility_chain_write
- typedef std::string word; std::vector<word> words( 4 );
- words[0] = "foo"; words[1] = "bar"; words[2] = "baz";
- words[3] = "qux"; words[4] = "quux"; words[5] = "grault"; words[6] = "garply";
- array<word, 2> head; std::list<word> tail( 4 );
+ typedef std::string word; std::vector<word> words( 6 );
+ words[0] = "foo"; words[1] = "bar"; words[2] = "baz";
+ words[3] = "qux"; words[4] = "quux"; words[5] = "grault";
+ array<word, 3> head; std::list<word> tail( 3 );
             copy( words, begin( head | as2::_chain( tail ) ) );
-
- BOOST_ASSIGN_V2_CHECK( head[0] == "foo" );
- BOOST_ASSIGN_V2_CHECK( head[1] == "baz" );
+
+ BOOST_ASSIGN_V2_CHECK( head.front() == "foo" );
+ BOOST_ASSIGN_V2_CHECK( head.back() == "baz" );
             BOOST_ASSIGN_V2_CHECK( tail.front() == "qux" );
- BOOST_ASSIGN_V2_CHECK( tail.back() == "garply" );
+ BOOST_ASSIGN_V2_CHECK( tail.back() == "grault" );
             //]
         }
         // Boost.Assign.v2 containers
         {
             //[test_utility_chain_write_refs
             /*<< Needed to bring && into scope >>*/ using namespace assign::v2;
- std::vector<int> consecutive8( 8 ); for(int i = 1; i < 8; i++){ consecutive8[i] = 1 + i; }
+ std::vector<int> consecutive8( 8 ); for(int i = 0; i < 8; i++){ consecutive8[i] = 1 + i; }
             array<int, 5> consecutive5; int six, seven, eight;
             boost::copy(
                 consecutive8,

Modified: sandbox/assign_v2/libs/assign/v2/test/utility/chain.h
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/chain.h (original)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/chain.h 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -20,4 +20,4 @@
 }// xxx_utility
 }// test_assign_v2
 
-#endif
+#endif // LIBS_ASSIGN_V2_TEST_UTILITY_CHAIN_ER_2010_H

Modified: sandbox/assign_v2/libs/assign/v2/test/utility/conversion.h
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/conversion.h (original)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/conversion.h 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -20,4 +20,4 @@
 }// xxx_utility
 }// xxx_test_assign
 
-#endif
+#endif // LIBS_ASSIGN_V2_TEST_UTILITY_CONVERSION_ER_2010_H

Modified: sandbox/assign_v2/libs/assign/v2/test/utility/csv.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/csv.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/csv.cpp 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -16,7 +16,7 @@
 #include <libs/assign/v2/test/utility/csv.h>
 
 namespace test_assign_v2{
-namespace xxx_utiliy{
+namespace xxx_utility{
 namespace xxx_csv{
 
     void test(){
@@ -42,7 +42,7 @@
             //]
         }
         {
- //[test_utility_csv_modulo_deque
+ //[test_utility_csv_deque_modulo_
             BOOST_AUTO(
                 cont,
                 as2::csv( as2::deque<int>( as2::_nil ) % as2::_push_front, 72, 31, 48 )

Modified: sandbox/assign_v2/libs/assign/v2/test/utility/csv.h
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/csv.h (original)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/csv.h 2011-03-14 21:56:25 EDT (Mon, 14 Mar 2011)
@@ -20,4 +20,4 @@
 }// xxx_utility
 }// xxx_test_assign
 
-#endif
+#endif // LIBS_ASSIGN_V2_TEST_UTILITY_CSV_ER_2010_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