Boost logo

Boost :

From: Jon Willesen (jon_boost_at_[hidden])
Date: 2006-02-18 02:08:21


Thorsten Ottosen wrote:
>>> I think was the motivation. I had a user that called
>>> a constructor:
>>>
>>> cons( list_of(3)(5), 4, 5 );
>>>
>>> he wanted to pass 3 arguments, but only one was passed.

Jon Willesen wrote:
>> You got it backwards -- your example *does* pass three arguments.

Thorsten Ottosen wrote:
> Not before I removed operator,() from the class returned by list_of().
>
> That was my point.

Please see the attached program built with boost 1_32_0 which *does* have the
comma operator. On both msvc 7.1 and g++ 3.4.2 it outputs:

calling cons(list_of(3)(5), 4, 5)
cons 3
calling cons( (list_of(3)(5), 4, 5) )
cons 1

> So pick your medicine: reintroduce it to satisfy your program and break
> his or leave it as it is to break yours.

The above demonstrates his program won't break in the way you describe. The
danger I was thinking of lies in passing more arguments than intended, not
fewer.

> I think having that operator,() in the first release was a mistake.

Because of the above results, I'm not convinced of that yet. But if you
really want to keep the comma operator out, the list_of documentation needs
to be updated.

-- 
Jon

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