|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-02-05 18:50:57
Hi All,
For the next revision of boost.assign I have planned the following changes:
1. all arguments are passed by const reference
2. support for boost.graph
3. list_of()'s type has begin() and end() member functions. These will
now return a mutable iterator even though they are const.
(to allow better use of anonymous arrays)
4. a new super-efficient version of list_of() which can be used
whenever efficiency matters and when references needs to be
forwarded. For example:
template< class Range >
typename Range::const_iterator max_element( const Range& r )
{
return std::max_element( r.begin(), r.end() );
}
...
int a=1,b=5,c=3,d=4,e=2,f=9,g=0,h=7;
...
int& max = *max_element( list_of<8,int&>(a)(b)(c)(d)(e)(f)(g)(h) );
BOOST_CHECK_EQUAL( max, f );
max = 8;
BOOST_CHECK_EQUAL( f, 8 );
The question is if we should allow list_of<5,T> where T is not a reference or
if we should
require a reference argument (for the sake of efficiency).
Thanks for your feedback
-Thorsten
-- Thorsten Ottosen ---------------------------- Dezide Aps -- Intelligent Customer Support: www.dezide.com Aalborg University --- Decision Support Systems: http://www.cs.aau.dk/index2.php?content=Research/bss C++ Boost: www.boost.org C++ Standard: http://www.open-std.org/JTC1/SC22/WG21/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk