Boost logo

Boost :

Subject: Re: [boost] [local] Help for the Alternatives section
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-05-12 14:30:39


On Thu, May 12, 2011 at 11:16 AM, lcaminiti <lorcaminiti_at_[hidden]> wrote:

>
> Jeffrey Lee Hellrung, Jr.-2 wrote:
>
[...]

> > I would infer from this and the documentation that
> >
> > const bind(const int&) factor // outer const superfluous???
> > bind(const int&) factor
> > const bind(const int)& factor // outer const superfluous???
> > bind(const int)& factor
> > const bind(int)& factor
> > bind(const int&) const factor // outer const superfluous???
> > bind(int) const & factor
> >
> > are all equivalent, but I'm not sure. Can you please clarify in the
> > documentation?
> >
> > [...snip rest of example...]
> >
>
> Yes, the Tutorial section already mentions that:
> 1) const must always appear before bind when constant binding is used so
> bind ... const is not valid (this is just for simplicity, the macros could
> be programmed to accepts both const bind and bind const).
> 2) when const bind is used on a variable that is already const the bind's
> const has no effect.
>

So that addresses the placement of const; the '&' can also either be put
inside or outside the bind(...), right?

Also, what about commas from template instantiations? E.g., does

    bind(tmpl<T1,T2>) x

work?

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk