KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In C++0x, one can create a constexpr std::tuple, e.g. like #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); One also can query a std::tuple at runtime, e.g. via int i2 = std::get<0>(tup); But it is not possible to query it at compile time, e.g., constexpr int i2 = std::get<0>(tup); will throw a compilation error (at least with the latest g++ snapshot 2011-02-19). Is there any other way to query a constexpr std::tuple at compile time? And if not, is there a conceptual reason why one is not supposed to query it? (I am aware of avoiding using std::tuple, e.g., by using boost::mpl or boost::fusion instead, but somehow it sounds wrong not to use the tuple class in the new standard...). By the way, does anybody 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); not? Thanks a lot in advance! - lars
Tags (comma-separated)
Save Edits
Cancel