|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70800 - in sandbox/assign_v2: boost/assign/v2 boost/assign/v2/detail boost/assign/v2/detail/functor boost/assign/v2/detail/traits boost/assign/v2/detail/traits/aux_ boost/assign/v2/option boost/assign/v2/option/modifier boost/assign/v2/pipe libs/assign/v2 libs/assign/v2/test
From: erwann.rogard_at_[hidden]
Date: 2011-03-31 17:58:27
Author: e_r
Date: 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
New Revision: 70800
URL: http://svn.boost.org/trac/boost/changeset/70800
Log:
upd assign_v2
Text files modified:
sandbox/assign_v2/boost/assign/v2/detail/functor/pair.hpp | 24 ++++++++++++++----------
sandbox/assign_v2/boost/assign/v2/detail/keyword.hpp | 18 +++++++-----------
sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/fwd_container.hpp | 2 +-
sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/ptr_container.hpp | 30 +++++++++++++++---------------
sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/value_container.hpp | 8 ++++----
sandbox/assign_v2/boost/assign/v2/detail/traits/container.hpp | 24 ++++++++++++------------
sandbox/assign_v2/boost/assign/v2/option/data_generator.hpp | 27 ++++++++++++++++++++++-----
sandbox/assign_v2/boost/assign/v2/option/modifier/insert.hpp | 2 +-
sandbox/assign_v2/boost/assign/v2/pipe/csv_put.hpp | 15 +++++----------
sandbox/assign_v2/boost/assign/v2/put.hpp | 29 ++++-------------------------
sandbox/assign_v2/libs/assign/v2/test/chain.cpp | 14 +++++++-------
sandbox/assign_v2/libs/assign/v2/tutorial.cpp | 35 ++++++++++++++++++++---------------
12 files changed, 112 insertions(+), 116 deletions(-)
Modified: sandbox/assign_v2/boost/assign/v2/detail/functor/pair.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/functor/pair.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/functor/pair.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -27,7 +27,11 @@
//syntax_detail_functor_pair
namespace functor_aux{
- template<typename T, typename K, typename M>
+ template<
+ typename T // Value
+ , typename K // Key
+ , typename M // Mapped
+ >
class pair/*<-*/
#if !BOOST_ASSIGN_V2_ENABLE_CPP0X
: public functor_aux::crtp_unary_and_up<
@@ -63,22 +67,22 @@
using super_::operator();
- T impl( K const& k )const{
- return T( k, M() );
- }
+ T impl()const;// leave un-implemented
+#define BOOST_ASSIGN_V2_arg(z, I, data) BOOST_PP_CAT(data,BOOST_PP_INC(I))
#define BOOST_ASSIGN_V2_MACRO(z, N, data) \
- template<BOOST_PP_ENUM_PARAMS(N, typename T)> \
- T impl( K const& k BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, T, &_) )const{ \
- return T( k, M( BOOST_PP_ENUM_PARAMS(N, _) ) ); \
- } \
+ template<BOOST_PP_ENUM_PARAMS(N, typename T)> \
+ T impl( BOOST_PP_ENUM_BINARY_PARAMS(N, T, &_) )const{ \
+ return T( _0, M( BOOST_PP_ENUM(BOOST_PP_DEC(N), BOOST_ASSIGN_V2_arg, _) ) ); \
+ } \
/**/
BOOST_PP_REPEAT_FROM_TO(
- 1,
- BOOST_ASSIGN_V2_LIMIT_ARITY,
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_ARITY),
BOOST_ASSIGN_V2_MACRO,
~
)
+#undef BOOST_ASSIGN_V2_arg
#undef BOOST_ASSIGN_V2_MACRO
#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
Modified: sandbox/assign_v2/boost/assign/v2/detail/keyword.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/keyword.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/keyword.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -17,26 +17,22 @@
//[syntax_detail_keyword
namespace keyword_aux{
- struct use_default/*<-*/{}/*->*/;
-
struct ignore{
ignore(){}
template<typename Anything> ignore(Anything){}
};
-
struct key/*<-*/{}/*->*/;
struct nil/*<-*/{}/*->*/;
+ struct use_default/*<-*/{}/*->*/;
+ struct value/*<-*/{}/*->*/;
}// keyword_aux
/*<-*/namespace{/*->*/
- const keyword_aux::use_default _use_default/*<-*/
- = keyword_aux::use_default()/*->*/;
- const keyword_aux::ignore _ignore/*<-*/
- = keyword_aux::ignore()/*->*/;
- const keyword_aux::key _key/*<-*/
- = keyword_aux::key()/*->*/;
- const keyword_aux::nil _nil/*<-*/
- = keyword_aux::nil()/*->*/;
+ const keyword_aux::ignore _ignore/*<-*/ = keyword_aux::ignore()/*->*/;
+ const keyword_aux::key _key/*<-*/ = keyword_aux::key()/*->*/;
+ const keyword_aux::nil _nil/*<-*/ = keyword_aux::nil()/*->*/;
+ const keyword_aux::use_default _use_default/*<-*/ = keyword_aux::use_default()/*->*/;
+ const keyword_aux::value _value/*<-*/ = keyword_aux::value()/*->*/;
/*<-*/}/*->*/
//]
}// v2
Modified: sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/fwd_container.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/fwd_container.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/fwd_container.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -77,7 +77,7 @@
>
class unordered_multiset;
- // POINTER-CONTAINERS
+ // POINTER-CONTAINERS
template
<
Modified: sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/ptr_container.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/ptr_container.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/ptr_container.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -22,19 +22,19 @@
namespace container_aux{
- // DATA-MEMBER
+ // DATA-MEMBER
template<typename PtrC>
struct to_value_key{ typedef typename PtrC::key_type type; };
template<typename PtrC>
struct to_value_value : boost::remove_reference<
- typename PtrC::reference
+ typename PtrC::reference
>{};
template<typename PtrC>
struct to_value_mapped : boost::remove_reference<
- typename PtrC::mapped_reference
+ typename PtrC::mapped_reference
>{};
template
@@ -46,14 +46,14 @@
class Allocator
>
struct to_value_value<
- boost::ptr_map<Key, Mapped, Compare, CloneAllocator, Allocator>
+ boost::ptr_map<Key, Mapped, Compare, CloneAllocator, Allocator>
>{
- typedef boost::ptr_map<
- Key, Mapped, Compare, CloneAllocator, Allocator
+ typedef boost::ptr_map<
+ Key, Mapped, Compare, CloneAllocator, Allocator
> ptr_c_;
typedef std::pair<
- const typename to_value_key<ptr_c_>::type,
+ const typename to_value_key<ptr_c_>::type,
typename to_value_mapped<ptr_c_>::type
> type;
};
@@ -103,8 +103,8 @@
// MAP
template<
- typename PtrC,
- template<typename, typename, typename, typename> class C
+ typename PtrC,
+ template<typename, typename, typename, typename> class C
>
struct to_value_map{
@@ -112,7 +112,7 @@
typename to_value_key<PtrC>::type,
typename to_value_mapped<PtrC>::type,
typename PtrC::key_compare,
- typename to_value_allocator<PtrC>::type
+ typename to_value_allocator<PtrC>::type
> type;
};
@@ -164,7 +164,7 @@
// TO_VALUE_CONTAINER
template<
- typename C // Pointer or Value container
+ typename C // Pointer or Value container
>
struct to_value_container{ typedef C type; };
@@ -264,11 +264,11 @@
>
struct to_value_container<
boost::ptr_unordered_map<
- Key, Mapped, Hash, Pred, CloneAllocator, Allocator
+ Key, Mapped, Hash, Pred, CloneAllocator, Allocator
>
> : to_value_unordered_map<
boost::ptr_unordered_map<
- Key, Mapped, Hash, Pred, CloneAllocator, Allocator
+ Key, Mapped, Hash, Pred, CloneAllocator, Allocator
>,
boost::unordered_map
>{};
@@ -285,11 +285,11 @@
>
struct to_value_container<
boost::ptr_unordered_set<
- Key, Hash, Pred, CloneAllocator, Allocator
+ Key, Hash, Pred, CloneAllocator, Allocator
>
> : to_value_unordered_set<
boost::ptr_unordered_set<
- Key, Hash, Pred, CloneAllocator, Allocator
+ Key, Hash, Pred, CloneAllocator, Allocator
>,
boost::unordered_set
>{};
Modified: sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/value_container.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/value_container.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/traits/aux_/value_container.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -104,20 +104,20 @@
// DATA-MEMBER
template<
- typename C // Ptr or value container
+ typename C // Ptr or value container
>
struct value_key{ typedef typename C::key_type type; };
template<
- typename C // Ptr or value container
+ typename C // Ptr or value container
>
struct value_value{ typedef typename C::value_type type; };
template<
- typename C // Ptr or value container
+ typename C // Ptr or value container
>
struct value_mapped{
- typedef typename C::mapped_type type;
+ typedef typename C::mapped_type type;
};
Modified: sandbox/assign_v2/boost/assign/v2/detail/traits/container.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/detail/traits/container.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/detail/traits/container.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -32,8 +32,8 @@
template<template<typename > class F, typename C>
struct through_value_container
- : F<
- typename to_value_container<C>::type
+ : F<
+ typename to_value_container<C>::type
>
{};
@@ -59,44 +59,44 @@
template<typename C>
struct has_push_deduced_value
- : through_value_container<value_has_push_deduced_value, C>
+ : through_value_container<value_has_push_deduced_value, C>
{};
// CATEGORY
template<typename C> struct is_array
- : through_value_container<value_is_array, C>
+ : through_value_container<value_is_array, C>
{};
template<typename C>
struct is_associative
- : through_value_container<value_is_associative, C>
+ : through_value_container<value_is_associative, C>
{};
template<typename C>
struct is_fifo
- : through_value_container<value_is_fifo, C>
+ : through_value_container<value_is_fifo, C>
{};
template<typename C>
struct is_lifo
- : through_value_container<value_is_lifo, C>
+ : through_value_container<value_is_lifo, C>
{};
template<typename C> struct is_map
- : through_value_container<value_is_map, C>
+ : through_value_container<value_is_map, C>
{};
template<typename C>
struct is_sorted
- : through_value_container<value_is_sorted, C>
- {};
+ : through_value_container<value_is_sorted, C>
+ {};
}// container_aux
- template<typename C>
+ template<typename C>
struct value_container_value/*<-*/
- : container_aux::value<C>{}
+ : container_aux::value<C>{}
/*->*/;
}// v2
Modified: sandbox/assign_v2/boost/assign/v2/option/data_generator.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/option/data_generator.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/option/data_generator.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -12,6 +12,7 @@
#include <boost/assign/v2/detail/functor/value.hpp>
#include <boost/assign/v2/detail/keyword.hpp>
#include <boost/assign/v2/detail/pp/ignore.hpp>
+#include <boost/assign/v2/detail/traits/container.hpp>
#include <boost/assign/v2/interpreter/data_generator.hpp>
#include <boost/assign/v2/interpreter/fwd.hpp>
#include <boost/assign/v2/interpreter/replace.hpp>
@@ -33,6 +34,16 @@
typedef functor_aux::value<key_> type;
}/*->*/;
+ template<
+ typename C // Value or pointer-container
+ >
+ struct deduce_value_generator/*<-*/
+ {
+ typedef functor_aux::value<
+ typename container_aux::value<C>::type
+ > type;
+ }/*->*/;
+
namespace result_of{
template<typename D, typename C, typename F = keyword_aux::use_default>
@@ -44,20 +55,26 @@
{}/*->*/;
template<typename D, typename C>
+ struct option_data_generator<D, C, keyword_aux::key>/*<-*/
+ : option_data_generator<
+ D, C, typename deduce_key_generator<C>::type
+ >
+ {}/*->*/;
+
+ template<typename D, typename C>
struct option_data_generator<D, C, keyword_aux::use_default>/*<-*/
: option_data_generator<
D, C, typename deduce_data_generator<C>::type
>
{}/*->*/;
-
+
template<typename D, typename C>
- struct option_data_generator<D, C, keyword_aux::key>/*<-*/
+ struct option_data_generator<D, C, keyword_aux::value>/*<-*/
: option_data_generator<
- D, C, typename deduce_key_generator<C>::type
+ D, C, typename deduce_value_generator<C>::type
>
{}/*->*/;
-
-
+
}// result_of
template<typename F/*<-*/= keyword_aux::ignore/*->*/>
Modified: sandbox/assign_v2/boost/assign/v2/option/modifier/insert.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/option/modifier/insert.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/option/modifier/insert.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -76,7 +76,7 @@
void impl( C& cont, BOOST_ASSIGN_V2_arg, data_tag::ptr_map )const
{
typedef typename container_aux::key<C>::type key_;
- // non-const key necessary. See ptr_map.
+ // non-const key necessary. See ptr_map.
key_ k = BOOST_ASSIGN_V2_forward.first;
typedef typename container_aux::mapped<C>::type m_;
cont.insert( k , new m_( BOOST_ASSIGN_V2_forward.second ) );
Modified: sandbox/assign_v2/boost/assign/v2/pipe/csv_put.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/pipe/csv_put.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/pipe/csv_put.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -12,6 +12,7 @@
#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
#include <boost/assign/v2/put.hpp>
#include <boost/assign/v2/option/list.hpp>
+#include <boost/assign/v2/option/data_generator.hpp>
#include <boost/assign/v2/ref/array/as_arg_list.hpp>
#include <boost/assign/v2/ref/array/csv_array.hpp>
#include <boost/assign/v2/ref/wrapper/copy.hpp>
@@ -179,16 +180,10 @@
>
C& operator|(C& cont, interpreter_aux::arg_list<H, T, N, U> const& arg_list)/*<-*/
{
- typedef typename v2::result_of::put<
- C
- , functor_aux::value<
- typename container_aux::value<C>::type
- >
- , typename interpreter_aux::deduce_modifier_tag<C>::type
- , typename interpreter_aux::deduce_data_tag<C>::type
- >::type put_;
- v2::ref::as_arg_list(
- arg_list.apply( put_( cont ) ),
+ typedef typename deduce_value_generator<C>::type data_gen_;
+ typedef typename v2::result_of::put<C, data_gen_>::type put_;
+ v2::ref::as_arg_list(
+ arg_list.apply( put_( cont ) ),
arg_list.arg_list_cont()
);
return cont;
Modified: sandbox/assign_v2/boost/assign/v2/put.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/put.hpp (original)
+++ sandbox/assign_v2/boost/assign/v2/put.hpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -110,18 +110,14 @@
typename C/*<-*/
, typename DataGenerator
= typename interpreter_aux::deduce_data_generator<C>::type
- , typename ModifierTag
- = typename interpreter_aux::deduce_modifier_tag<C>::type
- , typename DataTag
- = typename interpreter_aux::deduce_data_tag<C>::type/*->*/
>
struct put/*<-*/{
typedef
interpreter_aux::put_interpreter<
- C,
- DataGenerator,
- ModifierTag,
- DataTag
+ C
+ , DataGenerator
+ , typename interpreter_aux::deduce_modifier_tag<C>::type
+ , typename interpreter_aux::deduce_data_tag<C>::type
>
type;
}/*->*/;
@@ -136,23 +132,6 @@
return result_( cont );
}BOOST_ASSIGN_V2_IGNORE(/*->*/;/*<-*/)/*->*/
-/*<-*/
- template<
- typename DataGenerator
- ,typename ModifierTag
- ,typename DataTag
- ,typename C
- >
- typename result_of::put<C, DataGenerator, ModifierTag, DataTag>::type
- put( C& cont )
- {
- typedef typename result_of::put<
- C, DataGenerator, ModifierTag, DataTag
- >::type result_;
- return result_( cont );
- }
-
-/*->*/
//]
}// v2
}// assign
Modified: sandbox/assign_v2/libs/assign/v2/test/chain.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/chain.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/test/chain.cpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -63,18 +63,18 @@
//]
}
// Boost.Assign.v2 containers
- {
+ {
//[test_chain_write_refs
/*<< Needed to bring && into scope >>*/ using namespace assign::v2;
- std::vector<int> consecutive8( 8 );
- for(int i = 0; i < 8; i++){ consecutive8[i] = 1 + i; }
- array<int, 5> consecutive5; int six, seven, eight;
+ std::vector<int> iota8( 8 );
+ for(int i = 0; i < 8; i++){ iota8[i] = 1 + i; }
+ array<int, 5> iota5; int six, seven, eight;
boost::copy(
- consecutive8,
- boost::begin( consecutive5 && (/*<< rvalue! >>*/ as2::ref::csv_array( six, seven, eight ) | as2::ref::_get ) )
+ iota8,
+ boost::begin( iota5 && (/*<< rvalue! >>*/ as2::ref::csv_array( six, seven, eight ) | as2::ref::_get ) )
);
- BOOST_ASSIGN_V2_CHECK( range::equal( consecutive5, as2::csv_deque( 1, 2, 3, 4, 5 ) ) );
+ BOOST_ASSIGN_V2_CHECK( range::equal( iota5, as2::csv_deque( 1, 2, 3, 4, 5 ) ) );
BOOST_ASSIGN_V2_CHECK( six == 6 ); BOOST_ASSIGN_V2_CHECK( seven == 7 ); BOOST_ASSIGN_V2_CHECK( eight == 8 );
//]
}
Modified: sandbox/assign_v2/libs/assign/v2/tutorial.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/tutorial.cpp (original)
+++ sandbox/assign_v2/libs/assign/v2/tutorial.cpp 2011-03-31 17:58:25 EDT (Thu, 31 Mar 2011)
@@ -35,14 +35,15 @@
using namespace assign::v2;
{
//[tutorial_assign
- std::vector<int> numeric( 10 ); iota( numeric, 0 ); typedef std::string str_;
- typedef variant< int, str_ > data_; array<data_, 16> numeric_kb;
- put( numeric_kb )
+ std::vector<int> numeric( 10 ); iota( numeric, 0 );
+ typedef std::string str_; typedef variant< int, str_ > data_;
+ array<data_, 16> numeric_keyboard;
+ put( numeric_keyboard )
( "+" )( "-" )( "*" )( "/" )( "=" )( "." )
( as_arg_list( numeric ) );
- assert( get<str_>( numeric_kb.front() ) == "+" );
- assert( get<int>( numeric_kb.back() ) == 9 );
+ assert( get<str_>( numeric_keyboard.front() ) == "+" );
+ assert( get<int>( numeric_keyboard.back() ) == 9 );
//]
}
{
@@ -75,16 +76,16 @@
}
{
//[tutorial_chain
- std::vector<int> consecutive8( 8 ); for(int i = 0; i < 8; i++){ consecutive8[i] = 1 + i; }
- array<int, 5> consecutive5; int six, seven, eight;
+ std::vector<int> iota8( 8 ); for(int i = 0; i < 8; i++){ iota8[i] = 1 + i; }
+ array<int, 5> iota5; int six, seven, eight;
boost::copy(
- consecutive8,
- boost::begin(
- consecutive5 | _chain( ref::csv_array( six, seven, eight ) | ref::_get )
+ iota8,
+ boost::begin(
+ iota5 | _chain( ref::csv_array( six, seven, eight ) | ref::_get )
)
);
- assert( range::equal( consecutive5, csv_deque(1, 2, 3, 4, 5) ) );
+ assert( range::equal( iota5, csv_deque(1, 2, 3, 4, 5) ) );
assert( six == 6 ); assert( seven == 7 ); assert( eight == 8 );
//]
}
@@ -97,11 +98,15 @@
}
{
//[tutorial_data_gen
- std::map<std::string, int> map;
- put( map )( "foo", 1 )( "bar", 2 )( "baz", 3 )("qux");
+ typedef std::string str_;
+ const char foo[] = "foo";
+ const char bar[4] = { 'b', 'a', 'r', '\0' };
+ str_ baz = "***baz***";
+ std::map<int, str_> map;
+ put( map )( 1, foo, 3 )( 2, bar )( 3, baz, 3, 3 )( 4, "qux");
- assert( map["bar"] == 2 );
- assert( map["qux"] == int() );
+ assert( map[1] == "foo" ); assert( map[2] == "bar" );
+ assert( map[3] == "baz" ); assert( map[4] == "qux" );
//]
}
{
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