
"Gennadiy Rozental" <gennadiy.rozental@thomson.com> wrote in message news:c59i86$39d$1@sea.gmane.org...
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.
(a) My comments about boost::bind comes from http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm But bind's reference docs seems to use by-value. (b) I've attached a small example that demonstrates why we should not use by-value: 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 since it is declared const.
Yes, it's simple. Just stuff the values into a temporary and provide a conversion operator. 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 convinient) 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.
true.
(b) is used with operator<<(). If this goes away, it will sill eb used in eg
assign_all( array ) = 1,2,3;
Why?
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 what its good for. Having a function/constructor with more than X arguments (x small) is hardly 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 a destructor; not very likely. Sutter has an article about it.
Where?
http://www.gotw.ca/gotw/047.htm
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 support partial ordering and you could remove all repetition from stl.hpp
neat. I'll use it when cleaning up the code. Thanks. br Thorsten begin 666 ref.cpp M#0HC:6YC;'5D92 \8F]O<W0O<F5F+FAP<#X-"B-I;F-L=61E(#QI;W-T<F5A M;3X-"@T*=7-I;F<@;F%M97-P86-E('-T9#L-"G5S:6YG(&YA;65S<&%C92!B 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@8VQA<W,@5" ^#0IV;VED(&9O M<G=A<F0H(%0@=" I#0I[#0H@(" @9F]O*"!T("D[#0I]#0H-"G1E;7!L871E M/"!C;&%S<R!4(#X-"G9O:60@<')O<&5R7V9O<G=A<F0H(&-O;G-T(%0F('0@ M*0T*>PT*(" @(&9O;R@@=" I.PT*?0T*#0II;G0@;6%I;B@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 M*"!I("D@+R\@=V]N)W0@8V]M<&EL90T*(" @('!R;W!E<E]F;W)W87)D*"!R 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` ` end