Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-11-18 11:34:32


Doug Gregor <dgregor_at_[hidden]> writes:

> On Nov 18, 2004, at 9:38 AM, David Abrahams wrote:
>> Daniel Wallin <dalwan01_at_[hidden]> writes:
>> One possible alternative is
>>
>> params.defaults_to("unnamed")[name]
>>
>> but I find that highly illogical to read, because the specification
>> of the default precedes the keyword it's defaulting.
>>
>> However, Thorsten's prodding has made me wonder if we need || for the
>> lazy case at all. It seems as though
>>
>> params.has(name) ? params[name] : something_else;
>>
>> is superior in every way except brevity. And there will be
>> substantial cases where it's briefer as well, because there's no need
>> to build a function object for something_else.
>>
>> Am I missing something?
>
> "something_else" still has to compile, whereas with "||
> something_lazy", "something_lazy()" does not have to compile.

That too. Okay, I was missing a lot. That's what happens when
there's a long gap between initial design and the review.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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