|
Boost : |
Subject: Re: [boost] [review][assign] Formal review of Assign v2 ongoing
From: er (er.ci.2020_at_[hidden])
Date: 2011-06-20 04:53:02
On 6/19/11 6:36 PM, er wrote:
> On 6/16/11 5:56 PM, John Bytheway wrote:
>> Please consider looking at the library and submitting a review.
>
> And please allow me to spark a bit of interest:
> { // Boost.Assign 2.0
> using namespace boost::assign::v2;
> map_ map;
> csv_put<2>( map, "jan", 31, "feb", 28, "mar", 31 );
> }
> }
>
Let's see a few variants (continuing the same example)
#include <boost/range/algorithm/copy.hpp>
#include <boost/assign/v2/include/do_csv_put.hpp>
#include <boost/assign/v2/include/csv_deque_ext.hpp>
#include <iostream>
#include <iterator>
// Variant #2
{ // Boost.Assign 2.0
using namespace boost::assign::v2;
map_ map;
boost::copy(
map | do_csv_put<2>( "jan", 31, "feb", 28, "mar", 31 )
| boost::adaptors::map_keys,
std::ostream_iterator<str_>( std::cout, " ")
); // prints feb jan mar
}
// Variant #3
{ // Boost.Assign 2.0
using namespace boost::assign::v2;
map_ map = converter(
csv_deque<p_, 2>( "jan", 31, "feb", 28, "mar", 31 )
);
}
PS:
- csv_deque<p_, I>( a1,...aI, ..., z1,...,zI ) is same as
deque<p_>( a1, ..., aI)...(z1, ..., zI)
- deque's nearest equivalent in Boost.Assign ( 1.0 ) is list_of
- do_csv_put<>() is C++0x only as of current revision
Any questions?
>> Where to get it
>> ===============
>>
>> The documentation is online at:
>>
>> <http://svn.boost.org/svn/boost/sandbox/assign_v2/libs/assign/v2/doc/html/index.html>
>>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk