|
Boost : |
Subject: [boost] [type_at] Variadic template utility
From: tymofey (tymofey_at_[hidden])
Date: 2011-05-26 03:34:44
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.
I hope this will be useful.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk