* How to query a constexpr std::tuple at compile time?
@ 2011-03-01 0:37 Lars Schmidt-Thieme
0 siblings, 0 replies; only message in thread
From: Lars Schmidt-Thieme @ 2011-03-01 0:37 UTC (permalink / raw)
To: gcc-help
Hi,
is there a reason why std::get for std::tuple
is not constexpr (in the recent C++0x standard
and in its g++ implementation) ? As it is, there
is no possibility to query a constexpr std::tuple
at compile time.
Example:
#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);
// In the following line, g++ (snapshot-2011-02-19) throws an error:
// std::get ... is not a constexpr function.
constexpr int i2 = std::get<0>(tup);
Sorry if this is a stupid request. I asked already at
http://stackoverflow.com/questions/5087364/how-to-query-a-constexpr-stdtuple-at-compile-time
, but nobody really seems to know...
There is also a bug report that evtl. may be related (not sure though):
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46507
Thanks
& best regards
Lars
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-03-01 0:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-01 0:37 How to query a constexpr std::tuple at compile time? Lars Schmidt-Thieme
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).