Subject: Re: [boost] Heads up - string_ref landing
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-11-17 16:24:37
On 16/11/12 16:00, Maxim Yanchenko wrote:
> Olaf van der Spek <ml <at> vdspek.org> writes:
>> On Fri, Nov 16, 2012 at 3:25 PM, Mathias Gaunard
>> <mathias.gaunard <at> ens-lyon.org> wrote:
>>> void f(std::string const&);
>> Are compilers/optimizers not smart enough to construct the temporary
>> object at compile time?
> I'm afraid they are not smart enough to eliminate an unneeded temporary when
> it's something sophisticated like std::string...
Doing that kind of transformation, assuming memory requirements were
relaxed to actually allow them, would require full-blown static analysis
on all of f's body.
So no, you can't expect any compiler to do it.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk