| @@ -35,6 +35,9 @@ dnl C++11 mode. Checked early so that we don't run into surprises. | |||||
| LOL_TRY_CXXFLAGS(-std=c++11, | LOL_TRY_CXXFLAGS(-std=c++11, | ||||
| [AM_CXXFLAGS="${AM_CXXFLAGS} -std=c++11" | [AM_CXXFLAGS="${AM_CXXFLAGS} -std=c++11" | ||||
| CXXFLAGS="${CXXFLAGS} -std=c++11"]) | CXXFLAGS="${CXXFLAGS} -std=c++11"]) | ||||
| LOL_TRY_CXXFLAGS(-std=c++0x, | |||||
| [AM_CXXFLAGS="${AM_CXXFLAGS} -std=c++0x" | |||||
| CXXFLAGS="${CXXFLAGS} -std=c++0x"]) | |||||
| AC_LANG_PUSH(C++) | AC_LANG_PUSH(C++) | ||||
| AC_MSG_CHECKING(for C++11 enum class support) | AC_MSG_CHECKING(for C++11 enum class support) | ||||
| @@ -12,6 +12,8 @@ | |||||
| # include "config.h" | # include "config.h" | ||||
| #endif | #endif | ||||
| #include <cctype> | |||||
| #include <lol/main.h> | #include <lol/main.h> | ||||
| #include "../../image/image-private.h" | #include "../../image/image-private.h" | ||||
| @@ -462,11 +462,6 @@ public: | |||||
| array_base *m_array; | array_base *m_array; | ||||
| }; | }; | ||||
| ConstIterator begin() const { return ConstIterator(this, 0); } | |||||
| ConstIterator end() const { return ConstIterator(this, m_count); } | |||||
| Iterator begin() { return Iterator(this, 0); } | |||||
| Iterator end() { return Iterator(this, m_count); } | |||||
| public: | public: | ||||
| inline int Count() const { return m_count; } | inline int Count() const { return m_count; } | ||||
| inline int Bytes() const { return m_count * sizeof(element_t); } | inline int Bytes() const { return m_count * sizeof(element_t); } | ||||
| @@ -897,11 +892,50 @@ public: | |||||
| #endif | #endif | ||||
| }; | }; | ||||
| /* Transitional alias for the camelcase version of lol::array */ | |||||
| /* | |||||
| * C++11 iterators | |||||
| */ | |||||
| template<typename T1, typename T2, typename T3, typename T4, | |||||
| typename T5, typename T6, typename T7, typename T8> | |||||
| typename array<T1,T2,T3,T4,T5,T6,T7,T8>::Iterator begin(array<T1,T2,T3,T4,T5,T6,T7,T8> &a) | |||||
| { | |||||
| return typename array<T1,T2,T3,T4,T5,T6,T7,T8>::Iterator(&a, 0); | |||||
| } | |||||
| template<typename T1, typename T2, typename T3, typename T4, | |||||
| typename T5, typename T6, typename T7, typename T8> | |||||
| typename array<T1,T2,T3,T4,T5,T6,T7,T8>::Iterator end(array<T1,T2,T3,T4,T5,T6,T7,T8> &a) | |||||
| { | |||||
| return typename array<T1,T2,T3,T4,T5,T6,T7,T8>::Iterator(&a, a.Count()); | |||||
| } | |||||
| template<typename T1, typename T2, typename T3, typename T4, | |||||
| typename T5, typename T6, typename T7, typename T8> | |||||
| typename array<T1,T2,T3,T4,T5,T6,T7,T8>::ConstIterator begin(array<T1,T2,T3,T4,T5,T6,T7,T8> const &a) | |||||
| { | |||||
| return typename array<T1,T2,T3,T4,T5,T6,T7,T8>::ConstIterator(&a, 0); | |||||
| } | |||||
| template<typename T1, typename T2, typename T3, typename T4, | |||||
| typename T5, typename T6, typename T7, typename T8> | |||||
| typename array<T1,T2,T3,T4,T5,T6,T7,T8>::ConstIterator end(array<T1,T2,T3,T4,T5,T6,T7,T8> const &a) | |||||
| { | |||||
| return typename array<T1,T2,T3,T4,T5,T6,T7,T8>::ConstIterator(&a, a.Count()); | |||||
| } | |||||
| /* | |||||
| * Transitional alias for the deprecated camelcase version of lol::array | |||||
| */ | |||||
| #if LOL_FEATURE_CXX11_TEMPLATE_ALIASES | |||||
| template<typename T1, typename T2 = void, typename T3 = void, | template<typename T1, typename T2 = void, typename T3 = void, | ||||
| typename T4 = void, typename T5 = void, typename T6 = void, | typename T4 = void, typename T5 = void, typename T6 = void, | ||||
| typename T7 = void, typename T8 = void> | typename T7 = void, typename T8 = void> | ||||
| using Array = array<T1, T2, T3, T4, T5, T6, T7, T8>; | using Array = array<T1, T2, T3, T4, T5, T6, T7, T8>; | ||||
| #else | |||||
| # define Array array | |||||
| #endif | |||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| @@ -45,6 +45,9 @@ | |||||
| #define LOL_FEATURE_CXX11_CONSTEXPR 0 | #define LOL_FEATURE_CXX11_CONSTEXPR 0 | ||||
| #define LOL_FEATURE_CXX11_ISNAN 0 | #define LOL_FEATURE_CXX11_ISNAN 0 | ||||
| /* This one is OK, except on GCC <= 4.6 */ | |||||
| #define LOL_FEATURE_CXX11_TEMPLATE_ALIASES 1 | |||||
| #if defined __GNUC__ /* GCC */ | #if defined __GNUC__ /* GCC */ | ||||
| # if defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L | # if defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L | ||||
| # undef LOL_FEATURE_CXX11_CONSTEXPR | # undef LOL_FEATURE_CXX11_CONSTEXPR | ||||
| @@ -52,6 +55,10 @@ | |||||
| # undef LOL_FEATURE_CXX11_ISNAN | # undef LOL_FEATURE_CXX11_ISNAN | ||||
| # define LOL_FEATURE_CXX11_ISNAN 1 | # define LOL_FEATURE_CXX11_ISNAN 1 | ||||
| # endif | # endif | ||||
| # if (__GNUC__ * 100 + __GNUC_MINOR__) < 470 | |||||
| # undef LOL_FEATURE_CXX11_TEMPLATE_ALIASES | |||||
| # define LOL_FEATURE_CXX11_TEMPLATE_ALIASES 0 | |||||
| # endif | |||||
| #elif defined __has_feature /* Clang */ | #elif defined __has_feature /* Clang */ | ||||
| # if __has_feature(cxx_constexpr) | # if __has_feature(cxx_constexpr) | ||||
| # undef LOL_FEATURE_CXX11_CONSTEXPR | # undef LOL_FEATURE_CXX11_CONSTEXPR | ||||
| @@ -59,12 +66,6 @@ | |||||
| # endif | # endif | ||||
| #endif | #endif | ||||
| #if LOL_FEATURE_CXX11_CONSTEXPR | |||||
| # define LOL_CONSTEXPR constexpr | |||||
| #else | |||||
| # define LOL_CONSTEXPR /* Nothing */ | |||||
| #endif | |||||
| /* | /* | ||||
| * Ensure we have nullptr. | * Ensure we have nullptr. | ||||
| @@ -375,12 +375,12 @@ template <typename T> struct Cmplx | |||||
| typedef Cmplx<T> type; | typedef Cmplx<T> type; | ||||
| inline constexpr Cmplx() {} | inline constexpr Cmplx() {} | ||||
| inline constexpr Cmplx(T X) : x(X), y(0) {} | |||||
| inline constexpr Cmplx(T X) : x(X), y(T(0)) {} | |||||
| inline constexpr Cmplx(T X, T Y) : x(X), y(Y) {} | inline constexpr Cmplx(T X, T Y) : x(X), y(Y) {} | ||||
| template<typename U> | template<typename U> | ||||
| explicit inline constexpr Cmplx(Cmplx<U> const &z) | explicit inline constexpr Cmplx(Cmplx<U> const &z) | ||||
| : Cmplx<T>(z[0], z[1]) {} | |||||
| : x(z.x), y(z.y) {} | |||||
| LOL_COMMON_MEMBER_OPS(x) | LOL_COMMON_MEMBER_OPS(x) | ||||
| LOL_NONVECTOR_MEMBER_OPS() | LOL_NONVECTOR_MEMBER_OPS() | ||||
| @@ -1136,7 +1136,7 @@ template <typename T> struct Quat | |||||
| template<typename U> | template<typename U> | ||||
| explicit inline constexpr Quat(Quat<U> const &q) | explicit inline constexpr Quat(Quat<U> const &q) | ||||
| : Quat<T>(q[0], q[1], q[2], q[3]) {} | |||||
| : w(q.w), x(q.x), y(q.y), z(q.z) {} | |||||
| Quat(matrix<3,3,T> const &m); | Quat(matrix<3,3,T> const &m); | ||||
| Quat(matrix<4,4,T> const &m); | Quat(matrix<4,4,T> const &m); | ||||