Browse Source

Oh, std::pair is not constexpr in C++11.

That's why.

This partially reverts commit 628201946b.
pull/141/head
Vladimír Vondruš 10 years ago
parent
commit
7ffe30c676
  1. 6
      src/Magnum/Test/VersionTest.cpp
  2. 6
      src/Magnum/Version.h

6
src/Magnum/Test/VersionTest.cpp

@ -75,11 +75,9 @@ void VersionTest::fromNumber() {
void VersionTest::toNumber() { void VersionTest::toNumber() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
constexpr const auto v = version(Version::GL430); CORRADE_COMPARE(version(Version::GL430), std::make_pair(4, 3));
CORRADE_COMPARE(v, std::make_pair(4, 3));
#else #else
constexpr const auto v = version(Version::GLES300); CORRADE_COMPARE(version(Version::GLES300), std::make_pair(3, 0));
CORRADE_COMPARE(v, std::make_pair(3, 0));
#endif #endif
} }

6
src/Magnum/Version.h

@ -118,9 +118,9 @@ constexpr Version version(Int major, Int minor) {
@see @ref isVersionES() @see @ref isVersionES()
*/ */
constexpr std::pair<Int, Int> version(Version version) { inline std::pair<Int, Int> version(Version version) {
return {(Int(version) & ~Implementation::VersionESMask)/100, const Int v = Int(version) & ~Implementation::VersionESMask;
((Int(version) & ~Implementation::VersionESMask)%100)/10}; return {v/100, (v%100)/10};
} }
/** /**

Loading…
Cancel
Save