|
Boost : |
Subject: Re: [boost] [mini-review] Update of Boost.Assign (13th-19th of June)
From: er (erwann.rogard_at_[hidden])
Date: 2010-06-18 20:22:06
> list_of(x).repeat(n,y) ---> NA
A compile time analog, for what it's worth, would work like this:
int a = 4;
BOOST_AUTO( tmp, repeat<3>(a) ); // internally calls ref_csv(a,a,a)
BOOST_ASSERT( tmp[0] == 4 );
BOOST_ASSERT( tmp[1] == 4 );
BOOST_ASSERT( tmp[2] == 4 );
BOOST_ASSERT( tmp.size() == 3 );
tmp[0] = 1;
BOOST_ASSERT( a == 1 );
tmp[1] = 2;
BOOST_ASSERT( a == 2 );
tmp[2] = 3;
BOOST_ASSERT( a == 3 );
It would be fairly to implement. I started here:
http://svn.boost.org/svn/boost/sandbox/statistics/support/boost/assign/auto_size/detail/repeat.hpp
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk