|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2006-02-04 23:22:13
Thorsten Ottosen <tottosen_at_[hidden]> writes:
>> No, that's not the same thing at all. Read what I wrote again.
>
> ok, so we could return a tripple {begin,found,end}.
I said quadruple. I meant {begin,found,found+1,end}.
> this means that
>
> 1. we loose the benefit of a default
The default might be a different function. In fact it would be in
your case, too, since you can't deduce an explicit template argument
from a default value.
> 2. a slight overhead (the tripple construction cannot be optmized away)
How do you know?
The compiler can optimize anything it wants as long as it doesn't
change the observable behavior.
> 3. at least as complicated an implementation
Maybe.
> I couldn't find the definition of "temporary" in the standard; is it
> defined and inherted from C?
It's not explicitly defined anywhere. The standard describes
situations in which a "temporary object" or "temporary" is created and
then has special rules for what can be done with such an object.
>> Sounds easy enough to do without a switch. And anyway, who cares
>> about such a tiny implementation detail?
>
> nobody unless it affects the generated code size/speed.
Right.
-- Dave Abrahams Boost Consulting 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