From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-04-10 20:13:23
"Gennadiy Rozental" <gennadiy.rozental_at_[hidden]> wrote in message
> So what about 1?
There seem to be more people who want this, but I leave it to Tom to
summarize required changes.
> > > 2. Forwarding problem
> > > This library is affected by forwarding problem. I do not know how
> > important
> > > it is, but may be we should use by-value scheme used by boost::bind?
> > won't boost::ref <> "solve" this. (don't bind use &?)
> No and no.
My comments about boost::bind comes from
But bind's reference docs seems to use by-value.
I've attached a small example that demonstrates why we should not
1. it passes a reference to a temporary
2. it removes constness (and do (1))
const& is good because
1. it disallows buggy code to compile
2. references can be passes with boost:ref
You must know something I have overlooked :-)
At the latest wg21 meeting, Dietmar was worried about function<> using by
by-value. So far I agree.
> > > 3. Library doesn't allow to create const collections.
> > > Well, I am not sure whether or not it's doable but currently it's not
> > > supported
> > It has already been suggested to support
> > const vector<int> v = init( v )(1)(2).
> How you plan to implement this? init( v ) wouldn't be able to modify v
> it is declared const.
Yes, it's simple. Just stuff the values into a temporary and provide a
I actually plan to support two versions
1. without container argument (slightly slower, convinient):
const vector<int> c = make_list(1)(1)(2)(3);
2. with container argument or properly specialized (slightly faster, less
const vector<int> c = list( c )(1)(1)(2)(3); // or
const vector<int> c = make_vector(1)(1)(2)(3);
For stl, it could make sence to add make_vector() etc. This kind of
anonymous list can also be used
with container algorithms:
copy( list(1)(2)(3), // bind to a const&
ostream_iterator<int>( cout ) );
Of course, this will have to be asssesed in a post-review version provided
the library is accepted.
> > (a) is used with operator+=()
> You don't need it
> template< typename C >
> inline insert_assigner<C>
> operator+=( C& c, const typename C::value_type& v )
> return insert_assigner<C>( c ), v;
> The same idea with second guy.
> > (b) is used with operator<<(). If this goes away, it will sill eb used
> > assign_all( array ) = 1,2,3;
no idea anymore :-)
> > > 2. Should we use Boost::pp to implement insert_assigner,
> > fixed_size_assigner
> > > e.t.c. and have configurable limit?
> > Some have wanted this. I have no problems with it besides I can't see
> > its good for.
> > Having a function/constructor with more than X arguments (x small) is
> > good practice.
> Why 6 then? Why not 4?
I agree four is even better.
> > > 4. ~fixed_size_assigner
> > > This method may throw an exception. Does it always safe to rely on
> > > uncaught_exception call?
> > No, it is not always safe, but the unsafe stuff happens if you use it in
> > destructor; not very
> > likely. Sutter has an article about it.
> > > 5. No function template ordering handling
> > > Why not use usual trick with extra long parameter?
> > Sure. What's the trick and what's the issue?
> template< typename C, typename V >
> inline void make_insertion( C& c, const V& v, long )
> c.insert( c.end(), v );
> void insert_( const value_type& v )
> make_insertion( c_, v, 0 ); // 0 is of type int
> Now you could use generic version even for compilers that does not
> partial ordering and you could remove all repetition from stl.hpp
neat. I'll use it when cleaning up the code. Thanks.
begin 666 ref.cpp
M;V]S=#L-"@T*=F]I9"!F;V\H(&EN="8@:2 I( T*>PT*(" @(&-O=70@/#P@
M)FD@/#P@(B B.PT*?0T*#0IT96UP;&%T93P_at_8VQA<W,@5" ^#0IV;VED(&9O
M<G=A<F0H(%0@=" I#0I[#0H@(" @9F]O*"!T("D[#0I]#0H-"G1E;7!L871E
M*0T*>PT*(" @(&9O;R@@=" I.PT*?0T*#0II;G0@;6%I;B_at_I#0I[#0H@(" @
M:6YT(&D@/2 Q.PT*(" @(&-O;G-T(&EN="!C:2 ](#$[#0H@(" @8V]U=" \
M/" F:2 \/" B("([#0H@(" @9F]R=V%R9"@@:2 I.R @+R\@;V]P<PT*(" @
M(&9O<G=A<F0H(&D@*3L@("\O(&]O<',-"B @(" O+W!R;W!E<E]F;W)W87)D
M968\:6YT/BAI*2 I.PT*(" @("\O<')O<&5R7V9O<G=A<F0H(&-R968\:6YT
=/BAI*2 I.R O+R!W;VXG="!C;VUP:6QE#0I]#0H`
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk