From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-04-12 04:37:27
"Vladimir Prus" <ghost_at_[hidden]> wrote in message
> Thorsten Ottosen wrote:
> >> > 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.
> Looking at the code, it seems boost::bind uses non-const reference for
> operator() -- the actual forwarding -- and by-value for arguments to
I must admit I don't get that. I extended rhe example to show the problems
As you point out, bind() *silently* compiles code that would not compile if
one called the original function with those arguments. IMO, *very*
the authors of bind/function please comment on why that has been allowed?
> So, you should add pass by non-const reference to the list of
yeah, that's one of the alternatives discussed in Howard and Dave's paper..
> What I think about it is that const-reference prevents you from passing
> non-const references to constructors of objects you put to container.
only in the sense that you need to use boost::ref<>
> with non-const references you'd break the passing of integer literals --
any "literal", in fact.
> which is the point of the library.
> Maybe, you really should support ref<> for passing non-const references.
Depends on what you mean by support :-) It's already supported by using
ref<>. I think
that is ok; afterall, reference arguments should not be used that much
begin 666 ref.cpp
M(&EN="8@:2 I( T*>PT*(" @(&-O=70@/#P@)FD@/#P@(B B.PT*?0T*#0IT
M96UP;&%T93P_at_8VQA<W,@5" ^#0IV;VED(&9O<G=A<F0H(%0@=" I#0I[#0H@
M<')O<&5R7V9O<G=A<F0H(&-O;G-T(%0F('0@*0T*>PT*(" @(&9O;R@@=" I
M.PT*?0T*#0II;G0@;6%I;B_at_I#0I[#0H@(" @:6YT(&D@/2 Q.PT*(" @(&-O
M;G-T(&EN="!C:2 ](#$[#0H@(" @8V]U=" \/" F:2 \/" B("([#0H@(" @
M9F]R=V%R9"@@:2 I.R @+R\@;V]P<PT*(" @(&9O<G=A<F0H(&D@*3L@("\O
M(&]O<',-"B @(" O+W!R;W!E<E]F;W)W87)D*"!I("D@+R\@=V]N)W0_at_8V]M
M<&EL90T*(" @('!R;W!E<E]F;W)W87)D*"!R968\:6YT/BAI*2 I.PT*(" @
M("\O<')O<&5R7V9O<G=A<F0H(&-R968\:6YT/BAI*2 I.R O+R!W;VXG="!C
M;VUP:6QE#0H@(" @8FEN9"@@9F]O+"!I("DH*3L@("\O(&]O<',-"B @("!B
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk