Subject: Re: [boost] [offtopic] C++11 useful trick
From: Eric Niebler (eric_at_[hidden])
Date: 2012-07-02 15:41:22
On 7/2/2012 11:18 AM, Mathias Gaunard wrote:
> On 02/07/2012 19:29, Eric Niebler wrote:
>> Yeah, it's booo-ring. ;-) Also, it needlessly instantiates O(N)
>> templates. And why write both a function template *and* a class template
>> when the function template alone will do? Now you have to maintain two
>> computations in parallel. I hate writing metafunctions to compute things
>> the compiler already knows. And in less trivial examples, the
>> metafunction wouldn't be so easy to write. BTW, only the implementation
>> of back needs to go in a struct. The user-visible function could fwd
>> to it.
> Have you done benchmarks that shows your approach is significantly faster?
> Use of a C++11 feature just for the sake of it doesn't seem like such a
> good idea to me.
<baffle> Have I not given enough good reasons above? Maybe I'll just
keep my good ideas to myself next time. :-/
> Especially since BOOST_TYPEOF in the return type tends
> to be quite fragile, so it cannot really be emulated.
True. This is only for C++11 code. That's why the subject says "C++11
useful trick". :-/
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk