$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Assign V2 - first impression
From: er (er.ci.2020_at_[hidden])
Date: 2011-06-23 11:14:00
> The following next example is also IMO convoluted, I've read it multiple
> times but I don't understand what it attempts to do.
>
> std::vector<int>  numeric( 10 ); iota( numeric, 0 );
>> typedef std::string str_; typedef variant<  int, str_>  data_;
>> array<data_, 17>  keypad;
>> csv(
>>      put( keypad ),
>>      "+", "-", "*", "/", "=", ".", "c"
>> ).for_each( numeric );
Call me nitpicky but this example was not meant to illustrate 
initialization, which does not come until Conversion in the tutorial. 
Therefore, it is not equivalent to your example below:
> Reading the assert macros, I guess this is equivalent?
>
> array<variant<int, std::string>, 17>  keypad =
> {
> "+", "-", "*", "/", "=", ".", "c",
> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
> };
>
The statement that would be equivalent to your statement is :
array<data_, 17> keypad = converter(
     csv_deque<data_, 1>(
         "+", "-", "*", "/", "=", ".", "c"
     ).for_each( numeric )
);
or (since you stated a preference for the variadic form):
array<data_, 17> keypad = converter(
     deque<data_>
         ( "+" )( "-" )( "*" )( "/" )( "=" )( "." )( "c" )
         .for_each( numeric )
);
Neither of which is as neat as C++0x's initialization list approach, as 
already acknowledged in a previous thread. But it's not always supported 
and does not help for filling a container either.