In C ++ 0x, you can create constexpr std :: tuple, for example. as
#include <tuple> constexpr int i = 10; constexpr float f = 2.4f; constexpr double d = -10.4; constexpr std::tuple<int, float, double> tup(i, f, d);
You can also request std :: tuple at run time, for example. via
int i2 = std::get<0>(tup);
But it is not possible to request it at compile time, for example,
constexpr int i2 = std::get<0>(tup);
will cause a compilation error (at least with the latest g ++ snapshot 2011-02-19).
Is there any other way to request constexpr std :: tuple at compile time?
And if not, is there a conceptual reason why no one should request it?
(I know about avoiding using std :: tuple, for example, using boost :: mpl or boost :: fusion instead, but somehow it seems wrong to not use the tuple class in the new standard ...).
By the way, does anyone know why
constexpr std::tuple<int, float, double> tup(i, f, d);
compiles fine but
constexpr std::tuple<int, float, double> tup(10, 2.4f, -10.4);
no?
Thank you very much! - lars