
Doug Gregor <dgregor@cs.indiana.edu> writes:
On Nov 18, 2004, at 9:38 AM, David Abrahams wrote:
Daniel Wallin <dalwan01@student.umu.se> 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