Boost logo

Boost :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2004-11-18 10:07:34


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.

        Doug


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