Subject: Re: [boost] [offtopic] C++11 useful trick
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-07-28 22:10:34
on Wed Jul 04 2012, Eric Niebler <eric-AT-boostpro.com> wrote:
> He's using a variant of the variadic tuple trick. He wants to find the
> Nth element in a parameter pack. So he puts all the elements in a
> tuple-like thingy (select_impl) which holds individual elements, each
> in its own base class (select_base). But only the Nth base actually
> holds onto its argument. (See the partial specialization of
> select_base.) His solution instantiates O(N) instances of select_base,
> but gets you the Nth element in O(1). Fiendishly clever.
That explanation doesn't match what I'm seeing in his latest attachment
(http://llvm.org/bugs/attachment.cgi?id=8838&action=edit), which doesn't
require storing anything. Which is pretty cool!
-- Dave Abrahams BoostPro Computing Software Development Training http://www.boostpro.com Clang/LLVM/EDG Compilers C++ Boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk