Boost logo

Boost :

From: Edward Diener (eddielee_at_[hidden])
Date: 2004-04-07 14:52:52

"Miro Jurisic" <macdev_at_[hidden]> wrote in message
> In article <c51662$3lh$1_at_[hidden]>,
> "Edward Diener" <eddielee_at_[hidden]> wrote:
> > In the first line of the next to last paragraph of the boost::bind
> > deocumentation under the heading of "Using nested binds for function
> > composition", it is stated:
> >
> > "Sometimes it is necessary not to evaluate the first argument, but not
> > evaluate some of the other arguments, even when they are nested bind
> > subexpressions. "
> >
> > I believe this is confusing and that a much clearer explanation of what
> > meant would be:
> >
> > "Although the first argument is, by default, not evaluated, all other
> > arguments are. Sometimes it is necessary not to evaluate arguments
> > subsequent to the first, even when they are nested bind subexpressions."
> Except that's not true. All arguments are evaluated, that's how C++ works;
> difference is that the first argument is the functor, and it's desirable
> evaluate it, and the remaining arguments are arguments, and it's often
> to defer their evaluation until the bound call is actually made.

I am referring to this line in the doc under 'Using nested binds for
function composition':

"Note that the first argument - the bound function object - is not
evaluated, even when it's a function object that is produced by bind or a
placeholder argument, so the example below does not work as expected."

> That said, I agree, that part of the documentation should be clarified.
The only
> reason I know this material is that I spent 3 hours on a compiler error
that was
> ostensibly explained in that paragraph, but the paragraph didn't make
> until I painfully discovered the material myself.

I await clarification for my apparent lack of understanding of the term
'evaluated' when it comes to the parameters which bind takes as arguments.
Maybe the difference between 'evaluated' and 'called' needs better
clarification. I know that I am slowly approaching the point of confusion
regarding nested binds, although I thought I knew how they worked from
practical experience with composition using nested binds.

Boost list run by bdawes at, gregod at, cpdaniel at, john at