|
Boost : |
Subject: Re: [boost] [type_at] Variadic template utility
From: tymofey (tymofey_at_[hidden])
Date: 2011-05-26 05:47:28
>Robert Jones <robertgbjones_at_[hidden]>
> On Thu, May 26, 2011 at 8:34 AM, tymofey <tymofey_at_[hidden]> wrote:
>
> > While experimenting with varidic templates of the upcoming standard i
> > discovered that quite often one would need to extract a type from parameter
> > pack at specified position. While the task is trivial it would be quite
> > handy to have a ready tool for this purpose, rather that specifying one
> > yourself every time.
> >
> > You can find source code consisting of a single header at
> > Vault/Utilities/type_at.hpp
> >
> > The usage is simple:
> >
> > boost::type_at<index, some_type_0, some_type_1, some_type_2,
> > some_type_n>::type
> >
> > corresponds to some_type_index where index is in range [0..n]. For example:
> >
> > boost::type_at<2, int, float, char, long>::type
> >
> > corresponds to char.
> >
> >
> Forgive me if I'm missing the point, but isn't this essentially Boost.MPL's
> 'at' metafunction?
>
> - Rob.
It is, but without the need to drag in mpl::vector with the limitations it imposes.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk