FAQ Database Discussion Community

c++ typedef/type substitution for enumeration class

As far as I am aware at the moment it is not possible to do a typedef of the C++11 enum class. I would like to know if there is any other way I can reduce the length of the name of an enum variable when referring to it outside...

Using `reinterpret_cast` on an enum class - valid or undefined behavior?

#include <iostream> #include <cassert> #include <type_traits> template<typename T> using Underlying = std::underlying_type_t<T>; enum class ETest : int { Zero = 0, One = 1, Two = 2 }; template<typename T> auto& castEnum(T& mX) noexcept { // `static_cast` does not compile // return static_cast<Underlying<T>&>(mX); return reinterpret_cast<Underlying<T>&>(mX); } int main() { auto...

How to Enable C++11 Features in Codelite

The following code compiles and runs in Xcode 5 and in Visual Studio 2013. I am interested in trying out Codelite, but Codelite will not compile the following program (a problem since I am working with scoped enums in my project). As far as I understand it, Codelite is using...