Boost logo

Boost :

Subject: Re: [boost] [local] Help for the Alternatives section
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2011-05-12 14:16:45


Jeffrey Lee Hellrung, Jr.-2 wrote:
>
> On Thu, May 12, 2011 at 9:05 AM, lcaminiti <lorcaminiti_at_[hidden]>
> wrote:
>
>>
>> Jeffrey Lee Hellrung, Jr.-2 wrote:
>> >
>> > On Fri, May 6, 2011 at 7:59 PM, Lorenzo Caminiti
>> > <lorcaminiti_at_[hidden]>wrote:
>> >
>> >> On Fri, May 6, 2011 at 2:07 PM, Lorenzo Caminiti
>> >> <lorcaminiti_at_[hidden]>
>> >> wrote:
>> >> > On Fri, May 6, 2011 at 1:32 PM, Jeffrey Lee Hellrung, Jr.
>> >> > <jeffrey.hellrung_at_[hidden]> wrote:
>> >> >> Would "const bind(int)& x" work?
>> >>
>> >> It think yes :) I should be able to support the syntax (also with
>> >> optional leading const and optional &):
>> >>
>> >> bind& x // deduced type (with Boost.Typeof)
>> >> bind(int)& x // specify type (no Boost.Typeof)
>> >>
>> >> More in general "[const] bind [(type)] [&] name" where "[t]" indicates
>> >> that token t is optional.
>> >>
>> > [...snip preprocessor details...]
>> >
>> > Awesome.
>> >
>>
>> I have implemented this:
>>
>>
>> http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html#boost_local.Advanced_Topics.specifying_bound_types
>>
>
> Great!
>
> Looks like a typo in the 4th bind use case:
>
> const bind(variable-type)& variable-name // Bind by constant value with
> explicit type.
>
> Should be "...by reference-to-const..." or "...by constant reference..."
> (depending on how you refer to such references throughout the
> documentation), eh?
>

Yep, a cut-n-paste error :) It should say "Bind by constant reference with
explicit type". I fixed it -- thanks for catching it.

> 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.

--Lorenzo

--
View this message in context: http://boost.2283326.n4.nabble.com/local-Help-for-the-Alternatives-section-tp3408469p3518297.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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