How to query a constexpr std::tuple at compile time?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux