Browse Source

GCC 4.4 compatibility: no comparison of strongly typed enums.

Explicitly define the operators to make the comparison usable at least
for Version enum.

This reverts commit 5ec4dff605.
Vladimír Vondruš 13 years ago
parent
commit
eb83ebe270
  1. 12
      src/Context.h

12
src/Context.h

@ -91,6 +91,14 @@ enum class Version: Int {
#endif
};
#if defined(CORRADE_GCC44_COMPATIBILITY) && !defined(DOXYGEN_GENERATING_OUTPUT)
/* GCC 4.4 somehow doesn't have comparison operators for strongly-typed enums */
inline bool operator<=(Version a, Version b) { return Int(a) <= Int(b); }
inline bool operator>=(Version a, Version b) { return Int(a) >= Int(b); }
inline bool operator<(Version a, Version b) { return Int(a) < Int(b); }
inline bool operator>(Version a, Version b) { return Int(a) > Int(b); }
#endif
/** @debugoperator{Magnum::Context} */
Debug MAGNUM_EXPORT operator<<(Debug debug, Version value);
@ -303,11 +311,7 @@ class MAGNUM_EXPORT Context {
* @see supportedVersion(), MAGNUM_ASSERT_VERSION_SUPPORTED()
*/
bool isVersionSupported(Version version) const {
#ifndef CORRADE_GCC44_COMPATIBILITY
return _version >= version;
#else
return static_cast<GLint>(_version) >= static_cast<GLint>(version);
#endif
}
/**

Loading…
Cancel
Save