diff options
Diffstat (limited to 'libstdc++-v3/include/std')
-rw-r--r-- | libstdc++-v3/include/std/atomic | 760 | ||||
-rw-r--r-- | libstdc++-v3/include/std/bitset | 104 | ||||
-rw-r--r-- | libstdc++-v3/include/std/chrono | 576 | ||||
-rw-r--r-- | libstdc++-v3/include/std/complex | 186 | ||||
-rw-r--r-- | libstdc++-v3/include/std/future | 37 | ||||
-rw-r--r-- | libstdc++-v3/include/std/limits | 1987 | ||||
-rw-r--r-- | libstdc++-v3/include/std/mutex | 21 | ||||
-rw-r--r-- | libstdc++-v3/include/std/ratio | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/std/tuple | 2 |
9 files changed, 2225 insertions, 1456 deletions
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic index c94597d..fc4cb86 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -38,8 +38,9 @@ # include <bits/c++0x_warning.h> #endif -#include <bits/c++config.h> #include <bits/atomic_base.h> +#include <bits/atomic_0.h> +#include <bits/atomic_2.h> _GLIBCXX_BEGIN_NAMESPACE(std) @@ -48,37 +49,103 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * @{ */ - /// kill_dependency - template<typename _Tp> - inline _Tp - kill_dependency(_Tp __y) - { - _Tp ret(__y); - return ret; - } - - inline memory_order - __calculate_memory_order(memory_order __m) + /// atomic_bool + // NB: No operators or fetch-operations for this type. + struct atomic_bool { - const bool __cond1 = __m == memory_order_release; - const bool __cond2 = __m == memory_order_acq_rel; - memory_order __mo1(__cond1 ? memory_order_relaxed : __m); - memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); - return __mo2; - } + private: + __atomic_base<bool> _M_base; + + public: + atomic_bool() = default; + ~atomic_bool() = default; + atomic_bool(const atomic_bool&) = delete; + atomic_bool& operator=(const atomic_bool&) = delete; + atomic_bool& operator=(const atomic_bool&) volatile = delete; + + constexpr atomic_bool(bool __i) : _M_base(__i) { } + + bool + operator=(bool __i) + { return _M_base.operator=(__i); } + + operator bool() const + { return _M_base.load(); } + + operator bool() const volatile + { return _M_base.load(); } + + bool + is_lock_free() const { return _M_base.is_lock_free(); } + + bool + is_lock_free() const volatile { return _M_base.is_lock_free(); } + + void + store(bool __i, memory_order __m = memory_order_seq_cst) + { _M_base.store(__i, __m); } + + void + store(bool __i, memory_order __m = memory_order_seq_cst) volatile + { _M_base.store(__i, __m); } + + bool + load(memory_order __m = memory_order_seq_cst) const + { return _M_base.load(__m); } + + bool + load(memory_order __m = memory_order_seq_cst) const volatile + { return _M_base.load(__m); } + + bool + exchange(bool __i, memory_order __m = memory_order_seq_cst) + { return _M_base.exchange(__i, __m); } + + bool + exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile + { return _M_base.exchange(__i, __m); } + + bool + compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, + memory_order __m2) + { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } + + bool + compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, + memory_order __m2) volatile + { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } + + bool + compare_exchange_weak(bool& __i1, bool __i2, + memory_order __m = memory_order_seq_cst) + { return _M_base.compare_exchange_weak(__i1, __i2, __m); } + + bool + compare_exchange_weak(bool& __i1, bool __i2, + memory_order __m = memory_order_seq_cst) volatile + { return _M_base.compare_exchange_weak(__i1, __i2, __m); } + + bool + compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, + memory_order __m2) + { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } + + bool + compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, + memory_order __m2) volatile + { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } + + bool + compare_exchange_strong(bool& __i1, bool __i2, + memory_order __m = memory_order_seq_cst) + { return _M_base.compare_exchange_strong(__i1, __i2, __m); } + + bool + compare_exchange_strong(bool& __i1, bool __i2, + memory_order __m = memory_order_seq_cst) volatile + { return _M_base.compare_exchange_strong(__i1, __i2, __m); } + }; - // - // Three nested namespaces for atomic implementation details. - // - // The nested namespace inlined into std:: is determined by the value - // of the _GLIBCXX_ATOMIC_PROPERTY macro and the resulting - // ATOMIC_*_LOCK_FREE macros. See file atomic_base.h. - // - // 0 == __atomic0 == Never lock-free - // 1 == __atomic1 == Best available, sometimes lock-free - // 2 == __atomic2 == Always lock-free -#include <bits/atomic_0.h> -#include <bits/atomic_2.h> /// atomic /// 29.4.3, Generic atomic type, primary class template. @@ -92,38 +159,68 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(_Tp __i) : _M_i(__i) { } + constexpr atomic(_Tp __i) : _M_i(__i) { } operator _Tp() const; + operator _Tp() const volatile; + _Tp operator=(_Tp __i) { store(__i); return __i; } + _Tp + operator=(_Tp __i) volatile { store(__i); return __i; } + + bool + is_lock_free() const; + bool is_lock_free() const volatile; void + store(_Tp, memory_order = memory_order_seq_cst); + + void store(_Tp, memory_order = memory_order_seq_cst) volatile; _Tp + load(memory_order = memory_order_seq_cst) const; + + _Tp load(memory_order = memory_order_seq_cst) const volatile; _Tp + exchange(_Tp __i, memory_order = memory_order_seq_cst); + + _Tp exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile; bool + compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order); + + bool compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile; bool - compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile; + compare_exchange_weak(_Tp&, _Tp, memory_order = memory_order_seq_cst); bool compare_exchange_weak(_Tp&, _Tp, memory_order = memory_order_seq_cst) volatile; bool + compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order); + + bool + compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile; + + bool + compare_exchange_strong(_Tp&, _Tp, memory_order = memory_order_seq_cst); + + bool compare_exchange_strong(_Tp&, _Tp, memory_order = memory_order_seq_cst) volatile; }; @@ -138,41 +235,70 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(_Tp* __v) : atomic_address(__v) { } + constexpr atomic(_Tp* __v) : atomic_address(__v) { } + + void + store(_Tp*, memory_order = memory_order_seq_cst); void - store(_Tp* __v, memory_order __m = memory_order_seq_cst) - { atomic_address::store(__v, __m); } + store(_Tp*, memory_order = memory_order_seq_cst) volatile; _Tp* - load(memory_order __m = memory_order_seq_cst) const - { return static_cast<_Tp*>(atomic_address::load(__m)); } + load(memory_order = memory_order_seq_cst) const; _Tp* - exchange(_Tp* __v, memory_order __m = memory_order_seq_cst) - { return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); } + load(memory_order = memory_order_seq_cst) const volatile; + + _Tp* + exchange(_Tp*, memory_order = memory_order_seq_cst); + + _Tp* + exchange(_Tp*, memory_order = memory_order_seq_cst) volatile; bool compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order); bool - compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order); + compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order) volatile; bool compare_exchange_weak(_Tp*&, _Tp*, memory_order = memory_order_seq_cst); bool + compare_exchange_weak(_Tp*&, _Tp*, + memory_order = memory_order_seq_cst) volatile; + + bool + compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order); + + bool + compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order) volatile; + + bool compare_exchange_strong(_Tp*&, _Tp*, memory_order = memory_order_seq_cst); + bool + compare_exchange_strong(_Tp*&, _Tp*, + memory_order = memory_order_seq_cst) volatile; + _Tp* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst); _Tp* + fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; + + _Tp* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst); + _Tp* + fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; + operator _Tp*() const { return load(); } + operator _Tp*() const volatile + { return load(); } + _Tp* operator=(_Tp* __v) { @@ -181,43 +307,51 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } _Tp* + operator=(_Tp* __v) volatile + { + store(__v); + return __v; + } + + _Tp* operator++(int) { return fetch_add(1); } _Tp* + operator++(int) volatile { return fetch_add(1); } + + _Tp* operator--(int) { return fetch_sub(1); } _Tp* + operator--(int) volatile { return fetch_sub(1); } + + _Tp* operator++() { return fetch_add(1) + 1; } _Tp* + operator++() volatile { return fetch_add(1) + 1; } + + _Tp* operator--() { return fetch_sub(1) - 1; } _Tp* + operator--() volatile { return fetch_sub(1) - 1; } + + _Tp* operator+=(ptrdiff_t __d) { return fetch_add(__d) + __d; } _Tp* + operator+=(ptrdiff_t __d) volatile + { return fetch_add(__d) + __d; } + + _Tp* operator-=(ptrdiff_t __d) { return fetch_sub(__d) - __d; } - }; - - - /// Explicit specialization for void* - template<> - struct atomic<void*> : public atomic_address - { - typedef void* __integral_type; - typedef atomic_address __base_type; - - atomic() = default; - ~atomic() = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - atomic(__integral_type __i) : __base_type(__i) { } - using __base_type::operator __integral_type; - using __base_type::operator=; + _Tp* + operator-=(ptrdiff_t __d) volatile + { return fetch_sub(__d) - __d; } }; /// Explicit specialization for bool. @@ -230,9 +364,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -248,9 +383,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -266,9 +402,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -284,9 +421,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -302,9 +440,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -320,9 +459,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -338,9 +478,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -356,9 +497,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -374,9 +516,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -392,9 +535,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -410,9 +554,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -428,9 +573,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -446,9 +592,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -464,9 +611,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; @@ -482,14 +630,36 @@ _GLIBCXX_BEGIN_NAMESPACE(std) atomic() = default; ~atomic() = default; atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - atomic(__integral_type __i) : __base_type(__i) { } + constexpr atomic(__integral_type __i) : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; + + template<typename _Tp> + _Tp* + atomic<_Tp*>::load(memory_order __m) const + { return static_cast<_Tp*>(atomic_address::load(__m)); } + + template<typename _Tp> + _Tp* + atomic<_Tp*>::load(memory_order __m) const volatile + { return static_cast<_Tp*>(atomic_address::load(__m)); } + + template<typename _Tp> + _Tp* + atomic<_Tp*>::exchange(_Tp* __v, memory_order __m) + { return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); } + + template<typename _Tp> + _Tp* + atomic<_Tp*>::exchange(_Tp* __v, memory_order __m) volatile + { return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); } + template<typename _Tp> bool atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1, @@ -502,6 +672,33 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _Tp> bool + atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1, + memory_order __m2) volatile + { + void** __vr = reinterpret_cast<void**>(&__r); + void* __vv = static_cast<void*>(__v); + return atomic_address::compare_exchange_weak(*__vr, __vv, __m1, __m2); + } + + template<typename _Tp> + bool + atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m) + { + return compare_exchange_weak(__r, __v, __m, + __calculate_memory_order(__m)); + } + + template<typename _Tp> + bool + atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, + memory_order __m) volatile + { + return compare_exchange_weak(__r, __v, __m, + __calculate_memory_order(__m)); + } + + template<typename _Tp> + bool atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v, memory_order __m1, memory_order __m2) @@ -513,17 +710,28 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _Tp> bool - atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, - memory_order __m) + atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v, + memory_order __m1, + memory_order __m2) volatile { - return compare_exchange_weak(__r, __v, __m, - __calculate_memory_order(__m)); + void** __vr = reinterpret_cast<void**>(&__r); + void* __vv = static_cast<void*>(__v); + return atomic_address::compare_exchange_strong(*__vr, __vv, __m1, __m2); + } + + template<typename _Tp> + bool + atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v, + memory_order __m) + { + return compare_exchange_strong(__r, __v, __m, + __calculate_memory_order(__m)); } template<typename _Tp> bool atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v, - memory_order __m) + memory_order __m) volatile { return compare_exchange_strong(__r, __v, __m, __calculate_memory_order(__m)); @@ -539,50 +747,141 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _Tp> _Tp* + atomic<_Tp*>::fetch_add(ptrdiff_t __d, memory_order __m) volatile + { + void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __d, __m); + return static_cast<_Tp*>(__p); + } + + template<typename _Tp> + _Tp* atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m) { void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m); return static_cast<_Tp*>(__p); } - // Convenience function definitions, atomic_flag. + template<typename _Tp> + _Tp* + atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m) volatile + { + void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m); + return static_cast<_Tp*>(__p); + } + + + // Function definitions, atomic_flag operations. inline bool atomic_flag_test_and_set_explicit(atomic_flag* __a, memory_order __m) { return __a->test_and_set(__m); } + inline bool + atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, + memory_order __m) + { return __a->test_and_set(__m); } + inline void atomic_flag_clear_explicit(atomic_flag* __a, memory_order __m) - { return __a->clear(__m); } + { __a->clear(__m); } + + inline void + atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m) + { __a->clear(__m); } + inline bool + atomic_flag_test_and_set(atomic_flag* __a) + { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); } - // Convenience function definitions, atomic_address. + inline bool + atomic_flag_test_and_set(volatile atomic_flag* __a) + { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_flag_clear(atomic_flag* __a) + { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } + + inline void + atomic_flag_clear(volatile atomic_flag* __a) + { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } + + + // Function definitions, atomic_address operations. inline bool atomic_is_lock_free(const atomic_address* __a) { return __a->is_lock_free(); } + inline bool + atomic_is_lock_free(const volatile atomic_address* __a) + { return __a->is_lock_free(); } + + inline void + atomic_init(atomic_address* __a, void* __v); + + inline void + atomic_init(volatile atomic_address* __a, void* __v); + + inline void + atomic_store_explicit(atomic_address* __a, void* __v, memory_order __m) + { __a->store(__v, __m); } + + inline void + atomic_store_explicit(volatile atomic_address* __a, void* __v, + memory_order __m) + { __a->store(__v, __m); } + inline void atomic_store(atomic_address* __a, void* __v) { __a->store(__v); } inline void - atomic_store_explicit(atomic_address* __a, void* __v, memory_order __m) - { __a->store(__v, __m); } + atomic_store(volatile atomic_address* __a, void* __v) + { __a->store(__v); } + + inline void* + atomic_load_explicit(const atomic_address* __a, memory_order __m) + { return __a->load(__m); } + + inline void* + atomic_load_explicit(const volatile atomic_address* __a, memory_order __m) + { return __a->load(__m); } inline void* atomic_load(const atomic_address* __a) { return __a->load(); } inline void* - atomic_load_explicit(const atomic_address* __a, memory_order __m) - { return __a->load(__m); } + atomic_load(const volatile atomic_address* __a) + { return __a->load(); } + + inline void* + atomic_exchange_explicit(atomic_address* __a, void* __v, memory_order __m) + { return __a->exchange(__v, __m); } + + inline void* + atomic_exchange_explicit(volatile atomic_address* __a, void* __v, + memory_order __m) + { return __a->exchange(__v, __m); } inline void* atomic_exchange(atomic_address* __a, void* __v) { return __a->exchange(__v); } inline void* - atomic_exchange_explicit(atomic_address* __a, void* __v, memory_order __m) - { return __a->exchange(__v, __m); } + atomic_exchange(volatile atomic_address* __a, void* __v) + { return __a->exchange(__v); } + + + inline bool + atomic_compare_exchange_weak_explicit(atomic_address* __a, + void** __v1, void* __v2, + memory_order __m1, memory_order __m2) + { return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); } + + inline bool + atomic_compare_exchange_weak_explicit(volatile atomic_address* __a, + void** __v1, void* __v2, + memory_order __m1, memory_order __m2) + { return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); } inline bool atomic_compare_exchange_weak(atomic_address* __a, void** __v1, void* __v2) @@ -592,72 +891,152 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } inline bool - atomic_compare_exchange_strong(atomic_address* __a, - void** __v1, void* __v2) + atomic_compare_exchange_weak(volatile atomic_address* __a, void** __v1, + void* __v2) { - return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst, + return __a->compare_exchange_weak(*__v1, __v2, memory_order_seq_cst, memory_order_seq_cst); } inline bool - atomic_compare_exchange_weak_explicit(atomic_address* __a, - void** __v1, void* __v2, - memory_order __m1, memory_order __m2) - { return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); } + atomic_compare_exchange_strong_explicit(atomic_address* __a, + void** __v1, void* __v2, + memory_order __m1, memory_order __m2) + { return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); } inline bool - atomic_compare_exchange_strong_explicit(atomic_address* __a, + atomic_compare_exchange_strong_explicit(volatile atomic_address* __a, void** __v1, void* __v2, memory_order __m1, memory_order __m2) { return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); } + inline bool + atomic_compare_exchange_strong(atomic_address* __a, void** __v1, void* __v2) + { + return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst, + memory_order_seq_cst); + } + + inline bool + atomic_compare_exchange_strong(volatile atomic_address* __a, + void** __v1, void* __v2) + { + return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst, + memory_order_seq_cst); + } + inline void* atomic_fetch_add_explicit(atomic_address* __a, ptrdiff_t __d, memory_order __m) { return __a->fetch_add(__d, __m); } inline void* + atomic_fetch_add_explicit(volatile atomic_address* __a, ptrdiff_t __d, + memory_order __m) + { return __a->fetch_add(__d, __m); } + + inline void* atomic_fetch_add(atomic_address* __a, ptrdiff_t __d) { return __a->fetch_add(__d); } inline void* + atomic_fetch_add(volatile atomic_address* __a, ptrdiff_t __d) + { return __a->fetch_add(__d); } + + inline void* atomic_fetch_sub_explicit(atomic_address* __a, ptrdiff_t __d, memory_order __m) { return __a->fetch_sub(__d, __m); } inline void* + atomic_fetch_sub_explicit(volatile atomic_address* __a, ptrdiff_t __d, + memory_order __m) + { return __a->fetch_sub(__d, __m); } + + inline void* atomic_fetch_sub(atomic_address* __a, ptrdiff_t __d) { return __a->fetch_sub(__d); } + inline void* + atomic_fetch_sub(volatile atomic_address* __a, ptrdiff_t __d) + { return __a->fetch_sub(__d); } + - // Convenience function definitions, atomic_bool. + // Function definitions, atomic_bool operations. inline bool atomic_is_lock_free(const atomic_bool* __a) { return __a->is_lock_free(); } + inline bool + atomic_is_lock_free(const volatile atomic_bool* __a) + { return __a->is_lock_free(); } + + inline void + atomic_init(atomic_bool* __a, bool __b); + + inline void + atomic_init(volatile atomic_bool* __a, bool __b); + + inline void + atomic_store_explicit(atomic_bool* __a, bool __i, memory_order __m) + { __a->store(__i, __m); } + + inline void + atomic_store_explicit(volatile atomic_bool* __a, bool __i, memory_order __m) + { __a->store(__i, __m); } + inline void atomic_store(atomic_bool* __a, bool __i) { __a->store(__i); } inline void - atomic_store_explicit(atomic_bool* __a, bool __i, memory_order __m) - { __a->store(__i, __m); } + atomic_store(volatile atomic_bool* __a, bool __i) + { __a->store(__i); } + + inline bool + atomic_load_explicit(const atomic_bool* __a, memory_order __m) + { return __a->load(__m); } + + inline bool + atomic_load_explicit(const volatile atomic_bool* __a, memory_order __m) + { return __a->load(__m); } inline bool atomic_load(const atomic_bool* __a) { return __a->load(); } inline bool - atomic_load_explicit(const atomic_bool* __a, memory_order __m) - { return __a->load(__m); } + atomic_load(const volatile atomic_bool* __a) + { return __a->load(); } + + inline bool + atomic_exchange_explicit(atomic_bool* __a, bool __i, memory_order __m) + { return __a->exchange(__i, __m); } + + inline bool + atomic_exchange_explicit(volatile atomic_bool* __a, bool __i, + memory_order __m) + { return __a->exchange(__i, __m); } inline bool atomic_exchange(atomic_bool* __a, bool __i) { return __a->exchange(__i); } inline bool - atomic_exchange_explicit(atomic_bool* __a, bool __i, memory_order __m) - { return __a->exchange(__i, __m); } + atomic_exchange(volatile atomic_bool* __a, bool __i) + { return __a->exchange(__i); } + + inline bool + atomic_compare_exchange_weak_explicit(atomic_bool* __a, bool* __i1, + bool __i2, memory_order __m1, + memory_order __m2) + { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } + + inline bool + atomic_compare_exchange_weak_explicit(volatile atomic_bool* __a, bool* __i1, + bool __i2, memory_order __m1, + memory_order __m2) + { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } inline bool atomic_compare_exchange_weak(atomic_bool* __a, bool* __i1, bool __i2) @@ -667,45 +1046,96 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } inline bool - atomic_compare_exchange_strong(atomic_bool* __a, bool* __i1, bool __i2) + atomic_compare_exchange_weak(volatile atomic_bool* __a, bool* __i1, bool __i2) { - return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst, - memory_order_seq_cst); + return __a->compare_exchange_weak(*__i1, __i2, memory_order_seq_cst, + memory_order_seq_cst); } inline bool - atomic_compare_exchange_weak_explicit(atomic_bool* __a, bool* __i1, - bool __i2, memory_order __m1, - memory_order __m2) - { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } + atomic_compare_exchange_strong_explicit(atomic_bool* __a, + bool* __i1, bool __i2, + memory_order __m1, memory_order __m2) + { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } inline bool - atomic_compare_exchange_strong_explicit(atomic_bool* __a, + atomic_compare_exchange_strong_explicit(volatile atomic_bool* __a, bool* __i1, bool __i2, memory_order __m1, memory_order __m2) { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } + inline bool + atomic_compare_exchange_strong(atomic_bool* __a, bool* __i1, bool __i2) + { + return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst, + memory_order_seq_cst); + } + inline bool + atomic_compare_exchange_strong(volatile atomic_bool* __a, + bool* __i1, bool __i2) + { + return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst, + memory_order_seq_cst); + } + + + // Function templates for atomic_integral operations, using + // __atomic_base . Template argument should be constricted to + // intergral types as specified in the standard. + template<typename _ITp> + inline bool + atomic_is_lock_free(const __atomic_base<_ITp>* __a) + { return __a->is_lock_free(); } + + template<typename _ITp> + inline bool + atomic_is_lock_free(const volatile __atomic_base<_ITp>* __a) + { return __a->is_lock_free(); } + + template<typename _ITp> + inline void + atomic_init(__atomic_base<_ITp>* __a, _ITp __i); + + template<typename _ITp> + inline void + atomic_init(volatile __atomic_base<_ITp>* __a, _ITp __i); - // Free standing functions. Template argument should be constricted - // to intergral types as specified in the standard. template<typename _ITp> inline void atomic_store_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) { __a->store(__i, __m); } template<typename _ITp> + inline void + atomic_store_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, + memory_order __m) + { __a->store(__i, __m); } + + template<typename _ITp> inline _ITp atomic_load_explicit(const __atomic_base<_ITp>* __a, memory_order __m) { return __a->load(__m); } template<typename _ITp> inline _ITp + atomic_load_explicit(const volatile __atomic_base<_ITp>* __a, + memory_order __m) + { return __a->load(__m); } + + template<typename _ITp> + inline _ITp atomic_exchange_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) { return __a->exchange(__i, __m); } template<typename _ITp> + inline _ITp + atomic_exchange_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, + memory_order __m) + { return __a->exchange(__i, __m); } + + template<typename _ITp> inline bool atomic_compare_exchange_weak_explicit(__atomic_base<_ITp>* __a, _ITp* __i1, _ITp __i2, @@ -714,6 +1144,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _ITp> inline bool + atomic_compare_exchange_weak_explicit(volatile __atomic_base<_ITp>* __a, + _ITp* __i1, _ITp __i2, + memory_order __m1, memory_order __m2) + { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } + + template<typename _ITp> + inline bool atomic_compare_exchange_strong_explicit(__atomic_base<_ITp>* __a, _ITp* __i1, _ITp __i2, memory_order __m1, @@ -721,6 +1158,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } template<typename _ITp> + inline bool + atomic_compare_exchange_strong_explicit(volatile __atomic_base<_ITp>* __a, + _ITp* __i1, _ITp __i2, + memory_order __m1, + memory_order __m2) + { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } + + template<typename _ITp> inline _ITp atomic_fetch_add_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) @@ -728,32 +1173,57 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _ITp> inline _ITp + atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, + memory_order __m) + { return __a->fetch_add(__i, __m); } + + template<typename _ITp> + inline _ITp atomic_fetch_sub_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) { return __a->fetch_sub(__i, __m); } template<typename _ITp> inline _ITp + atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, + memory_order __m) + { return __a->fetch_sub(__i, __m); } + + template<typename _ITp> + inline _ITp atomic_fetch_and_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) { return __a->fetch_and(__i, __m); } template<typename _ITp> inline _ITp + atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, + memory_order __m) + { return __a->fetch_and(__i, __m); } + + template<typename _ITp> + inline _ITp atomic_fetch_or_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) { return __a->fetch_or(__i, __m); } template<typename _ITp> inline _ITp + atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, + memory_order __m) + { return __a->fetch_or(__i, __m); } + + template<typename _ITp> + inline _ITp atomic_fetch_xor_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) { return __a->fetch_xor(__i, __m); } template<typename _ITp> - inline bool - atomic_is_lock_free(const __atomic_base<_ITp>* __a) - { return __a->is_lock_free(); } + inline _ITp + atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, + memory_order __m) + { return __a->fetch_xor(__i, __m); } template<typename _ITp> inline void @@ -761,16 +1231,31 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { atomic_store_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> + inline void + atomic_store(volatile __atomic_base<_ITp>* __a, _ITp __i) + { atomic_store_explicit(__a, __i, memory_order_seq_cst); } + + template<typename _ITp> inline _ITp atomic_load(const __atomic_base<_ITp>* __a) { return atomic_load_explicit(__a, memory_order_seq_cst); } template<typename _ITp> inline _ITp + atomic_load(const volatile __atomic_base<_ITp>* __a) + { return atomic_load_explicit(__a, memory_order_seq_cst); } + + template<typename _ITp> + inline _ITp atomic_exchange(__atomic_base<_ITp>* __a, _ITp __i) { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> + inline _ITp + atomic_exchange(volatile __atomic_base<_ITp>* __a, _ITp __i) + { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); } + + template<typename _ITp> inline bool atomic_compare_exchange_weak(__atomic_base<_ITp>* __a, _ITp* __i1, _ITp __i2) @@ -782,6 +1267,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _ITp> inline bool + atomic_compare_exchange_weak(volatile __atomic_base<_ITp>* __a, + _ITp* __i1, _ITp __i2) + { + return atomic_compare_exchange_weak_explicit(__a, __i1, __i2, + memory_order_seq_cst, + memory_order_seq_cst); + } + + template<typename _ITp> + inline bool atomic_compare_exchange_strong(__atomic_base<_ITp>* __a, _ITp* __i1, _ITp __i2) { @@ -791,30 +1286,65 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template<typename _ITp> + inline bool + atomic_compare_exchange_strong(volatile __atomic_base<_ITp>* __a, + _ITp* __i1, _ITp __i2) + { + return atomic_compare_exchange_strong_explicit(__a, __i1, __i2, + memory_order_seq_cst, + memory_order_seq_cst); + } + + template<typename _ITp> inline _ITp atomic_fetch_add(__atomic_base<_ITp>* __a, _ITp __i) { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp + atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i) + { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); } + + template<typename _ITp> + inline _ITp atomic_fetch_sub(__atomic_base<_ITp>* __a, _ITp __i) { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp + atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i) + { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); } + + template<typename _ITp> + inline _ITp atomic_fetch_and(__atomic_base<_ITp>* __a, _ITp __i) { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp + atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i) + { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); } + + template<typename _ITp> + inline _ITp atomic_fetch_or(__atomic_base<_ITp>* __a, _ITp __i) { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp + atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i) + { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); } + + template<typename _ITp> + inline _ITp atomic_fetch_xor(__atomic_base<_ITp>* __a, _ITp __i) { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } + template<typename _ITp> + inline _ITp + atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i) + { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } + // @} group atomics _GLIBCXX_END_NAMESPACE diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset index 1c71c4f..fafbb32 100644 --- a/libstdc++-v3/include/std/bitset +++ b/libstdc++-v3/include/std/bitset @@ -72,36 +72,39 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) /// 0 is the least significant word. _WordT _M_w[_Nw]; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + constexpr _Base_bitset() : _M_w({ }) { } + + constexpr _Base_bitset(unsigned long long __val) + : _M_w({ __val +#if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__ + , __val >> _GLIBCXX_BITSET_BITS_PER_WORD +#endif + }) { } +#else _Base_bitset() { _M_do_reset(); } -#ifdef __GXX_EXPERIMENTAL_CXX0X__ - _Base_bitset(unsigned long long __val) -#else _Base_bitset(unsigned long __val) -#endif { _M_do_reset(); _M_w[0] = __val; -#ifdef __GXX_EXPERIMENTAL_CXX0X__ - if (sizeof(unsigned long long) > sizeof(unsigned long)) - _M_w[1] = __val >> _GLIBCXX_BITSET_BITS_PER_WORD; -#endif } +#endif - static size_t + static _GLIBCXX_CONSTEXPR size_t _S_whichword(size_t __pos ) { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } - static size_t + static _GLIBCXX_CONSTEXPR size_t _S_whichbyte(size_t __pos ) { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } - static size_t + static _GLIBCXX_CONSTEXPR size_t _S_whichbit(size_t __pos ) { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } - static _WordT + static _GLIBCXX_CONSTEXPR _WordT _S_maskbit(size_t __pos ) { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } @@ -123,7 +126,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) _M_hiword() { return _M_w[_Nw - 1]; } - _WordT + _GLIBCXX_CONSTEXPR _WordT _M_hiword() const { return _M_w[_Nw - 1]; } @@ -368,31 +371,31 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) typedef unsigned long _WordT; _WordT _M_w; - _Base_bitset(void) + _GLIBCXX_CONSTEXPR _Base_bitset() : _M_w(0) { } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - _Base_bitset(unsigned long long __val) + constexpr _Base_bitset(unsigned long long __val) #else _Base_bitset(unsigned long __val) #endif : _M_w(__val) { } - static size_t + static _GLIBCXX_CONSTEXPR size_t _S_whichword(size_t __pos ) { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } - static size_t + static _GLIBCXX_CONSTEXPR size_t _S_whichbyte(size_t __pos ) { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } - static size_t + static _GLIBCXX_CONSTEXPR size_t _S_whichbit(size_t __pos ) { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } - static _WordT + static _GLIBCXX_CONSTEXPR _WordT _S_maskbit(size_t __pos ) { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } @@ -414,7 +417,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) _M_hiword() { return _M_w; } - _WordT + _GLIBCXX_CONSTEXPR _WordT _M_hiword() const { return _M_w; } @@ -511,29 +514,29 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) { typedef unsigned long _WordT; - _Base_bitset() + _GLIBCXX_CONSTEXPR _Base_bitset() { } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - _Base_bitset(unsigned long long) + constexpr _Base_bitset(unsigned long long) #else _Base_bitset(unsigned long) #endif { } - static size_t + static _GLIBCXX_CONSTEXPR size_t _S_whichword(size_t __pos ) { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } - static size_t + static _GLIBCXX_CONSTEXPR size_t _S_whichbyte(size_t __pos ) { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } - static size_t + static _GLIBCXX_CONSTEXPR size_t _S_whichbit(size_t __pos ) { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } - static _WordT + static _GLIBCXX_CONSTEXPR _WordT _S_maskbit(size_t __pos ) { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } @@ -545,13 +548,17 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) // make an unchecked call; all the memory ugliness is therefore // localized to this single should-never-get-this-far function. _WordT& - _M_getword(size_t) const + _M_getword(size_t) { __throw_out_of_range(__N("_Base_bitset::_M_getword")); return *new _WordT; } _WordT + _M_getword(size_t __pos) const + { return 0; } + + _GLIBCXX_CONSTEXPR _WordT _M_hiword() const { return 0; } @@ -632,13 +639,21 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) template<size_t _Extrabits> struct _Sanitize { - static void _S_do_sanitize(unsigned long& __val) - { __val &= ~((~static_cast<unsigned long>(0)) << _Extrabits); } + typedef unsigned long _WordT; + + static void + _S_do_sanitize(_WordT& __val) + { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); } }; template<> struct _Sanitize<0> - { static void _S_do_sanitize(unsigned long) {} }; + { + typedef unsigned long _WordT; + + static void + _S_do_sanitize(_WordT) { } + }; /** * @brief The %bitset class represents a @e fixed-size sequence of bits. @@ -713,11 +728,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) typedef unsigned long _WordT; void - _M_do_sanitize() - { - _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD>:: - _S_do_sanitize(this->_M_hiword()); - } + _M_do_sanitize() + { + typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type; + __sanitize_type::_S_do_sanitize(this->_M_hiword()); + } #ifdef __GXX_EXPERIMENTAL_CXX0X__ template<typename> friend class hash; @@ -740,8 +755,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) { friend class bitset; - _WordT *_M_wp; - size_t _M_bpos; + _WordT* _M_wp; + size_t _M_bpos; // left undefined reference(); @@ -799,17 +814,18 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) // 23.3.5.1 constructors: /// All bits set to zero. - bitset() + _GLIBCXX_CONSTEXPR bitset() { } /// Initial bits bitwise-copied from a single word (others set to zero). #ifdef __GXX_EXPERIMENTAL_CXX0X__ - bitset(unsigned long long __val) + constexpr bitset(unsigned long long __val) + : _Base(__val) { } #else bitset(unsigned long __val) -#endif : _Base(__val) { _M_do_sanitize(); } +#endif /** * @brief Use a subset of a string. @@ -1088,8 +1104,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) /** * @brief Array-indexing support. * @param position Index into the %bitset. - * @return A bool for a <em>const %bitset</em>. For non-const bitsets, an - * instance of the reference proxy class. + * @return A bool for a <em>const %bitset</em>. For non-const + * bitsets, an instance of the reference proxy class. * @note These operators do no range checking and throw no exceptions, * as required by DR 11 to the standard. * @@ -1101,7 +1117,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) */ reference operator[](size_t __position) - { return reference(*this,__position); } + { return reference(*this, __position); } bool operator[](size_t __position) const @@ -1236,7 +1252,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) { return this->_M_do_count(); } /// Returns the total number of bits. - size_t + _GLIBCXX_CONSTEXPR size_t size() const { return _Nb; } diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index 230b7f4..1d9552a 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -46,7 +46,7 @@ #ifdef _GLIBCXX_USE_C99_STDINT_TR1 -namespace std +namespace std { /** * @defgroup chrono Time @@ -71,71 +71,75 @@ namespace std // 20.8.2.3 specialization of common_type (for duration) template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> struct common_type<chrono::duration<_Rep1, _Period1>, - chrono::duration<_Rep2, _Period2>> + chrono::duration<_Rep2, _Period2>> { typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, - ratio<__static_gcd<_Period1::num, _Period2::num>::value, - (_Period1::den / __static_gcd<_Period1::den, _Period2::den>::value) - * _Period2::den>> type; + ratio<__static_gcd<_Period1::num, _Period2::num>::value, + (_Period1::den / __static_gcd<_Period1::den, _Period2::den>::value) + * _Period2::den>> type; }; - + // 20.8.2.3 specialization of common_type (for time_point) template<typename _Clock, typename _Duration1, typename _Duration2> struct common_type<chrono::time_point<_Clock, _Duration1>, - chrono::time_point<_Clock, _Duration2>> + chrono::time_point<_Clock, _Duration2>> { - typedef chrono::time_point<_Clock, - typename common_type<_Duration1, _Duration2>::type> type; + typedef chrono::time_point<_Clock, + typename common_type<_Duration1, _Duration2>::type> type; }; - namespace chrono + namespace chrono { // Primary template for duration_cast impl. template<typename _ToDuration, typename _CF, typename _CR, - bool _NumIsOne = false, bool _DenIsOne = false> + bool _NumIsOne = false, bool _DenIsOne = false> struct __duration_cast_impl { - template<typename _Rep, typename _Period> - static _ToDuration __cast(const duration<_Rep, _Period>& __d) - { - return _ToDuration(static_cast< - typename _ToDuration::rep>(static_cast<_CR>(__d.count()) - * static_cast<_CR>(_CF::num) - / static_cast<_CR>(_CF::den))); - } + template<typename _Rep, typename _Period> + static constexpr _ToDuration + __cast(const duration<_Rep, _Period>& __d) + { + return _ToDuration(static_cast< + typename _ToDuration::rep>(static_cast<_CR>(__d.count()) + * static_cast<_CR>(_CF::num) + / static_cast<_CR>(_CF::den))); + } }; template<typename _ToDuration, typename _CF, typename _CR> struct __duration_cast_impl<_ToDuration, _CF, _CR, true, true> { - template<typename _Rep, typename _Period> - static _ToDuration __cast(const duration<_Rep, _Period>& __d) - { - return _ToDuration( - static_cast<typename _ToDuration::rep>(__d.count())); - } + template<typename _Rep, typename _Period> + static constexpr _ToDuration + __cast(const duration<_Rep, _Period>& __d) + { + return _ToDuration( + static_cast<typename _ToDuration::rep>(__d.count())); + } }; template<typename _ToDuration, typename _CF, typename _CR> struct __duration_cast_impl<_ToDuration, _CF, _CR, true, false> { - template<typename _Rep, typename _Period> - static _ToDuration __cast(const duration<_Rep, _Period>& __d) - { - return _ToDuration(static_cast<typename _ToDuration::rep>( - static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den))); - } + template<typename _Rep, typename _Period> + static constexpr _ToDuration + __cast(const duration<_Rep, _Period>& __d) + { + return _ToDuration(static_cast<typename _ToDuration::rep>( + static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den))); + } }; template<typename _ToDuration, typename _CF, typename _CR> struct __duration_cast_impl<_ToDuration, _CF, _CR, false, true> { - template<typename _Rep, typename _Period> - static _ToDuration __cast(const duration<_Rep, _Period>& __d) - { - return _ToDuration(static_cast<typename _ToDuration::rep>( - static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num))); - } + template<typename _Rep, typename _Period> + static constexpr _ToDuration + __cast(const duration<_Rep, _Period>& __d) + { + return _ToDuration(static_cast<typename _ToDuration::rep>( + static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num))); + } }; template<typename _Tp> @@ -150,17 +154,17 @@ namespace std /// duration_cast template<typename _ToDuration, typename _Rep, typename _Period> - inline typename enable_if<__is_duration<_ToDuration>::value, + inline constexpr typename enable_if<__is_duration<_ToDuration>::value, _ToDuration>::type duration_cast(const duration<_Rep, _Period>& __d) { - typedef typename - ratio_divide<_Period, typename _ToDuration::period>::type __cf; - typedef typename - common_type<typename _ToDuration::rep, _Rep, intmax_t>::type __cr; + typedef typename + ratio_divide<_Period, typename _ToDuration::period>::type __cf; + typedef typename + common_type<typename _ToDuration::rep, _Rep, intmax_t>::type __cr; - return __duration_cast_impl<_ToDuration, __cf, __cr, - __cf::num == 1, __cf::den == 1>::__cast(__d); + return __duration_cast_impl<_ToDuration, __cf, __cr, + __cf::num == 1, __cf::den == 1>::__cast(__d); } /// treat_as_floating_point @@ -173,17 +177,17 @@ namespace std template<typename _Rep> struct duration_values { - static const _Rep - zero() - { return _Rep(0); } - - static const _Rep - max() - { return numeric_limits<_Rep>::max(); } - - static const _Rep - min() - { return numeric_limits<_Rep>::min(); } + static constexpr _Rep + zero() + { return _Rep(0); } + + static constexpr _Rep + max() + { return numeric_limits<_Rep>::max(); } + + static constexpr _Rep + min() + { return numeric_limits<_Rep>::min(); } }; template<typename T> @@ -200,98 +204,98 @@ namespace std template<typename _Rep, typename _Period> struct duration { + typedef _Rep rep; + typedef _Period period; + static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration"); - static_assert(__is_ratio<_Period>::value, + static_assert(__is_ratio<_Period>::value, "period must be a specialization of ratio"); - static_assert(_Period::num > 0, "period must be positive"); - - typedef _Rep rep; - typedef _Period period; - - // 20.8.3.1 construction / copy / destroy - duration() = default; - - template<typename _Rep2, typename = typename + static_assert(_Period::num > 0, "period must be positive"); + + // 20.8.3.1 construction / copy / destroy + constexpr duration() : __r() { } + + template<typename _Rep2, typename = typename enable_if<is_convertible<_Rep2, rep>::value && (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value)>::type> - explicit duration(const _Rep2& __rep) - : __r(static_cast<rep>(__rep)) { } + constexpr explicit duration(const _Rep2& __rep) + : __r(static_cast<rep>(__rep)) { } - template<typename _Rep2, typename _Period2, typename = typename - enable_if<treat_as_floating_point<rep>::value + template<typename _Rep2, typename _Period2, typename = typename + enable_if<treat_as_floating_point<rep>::value || (ratio_divide<_Period2, period>::type::den == 1 && !treat_as_floating_point<_Rep2>::value)>::type> - duration(const duration<_Rep2, _Period2>& __d) - : __r(duration_cast<duration>(__d).count()) { } + constexpr duration(const duration<_Rep2, _Period2>& __d) + : __r(duration_cast<duration>(__d).count()) { } ~duration() = default; duration(const duration&) = default; duration& operator=(const duration&) = default; - // 20.8.3.2 observer - rep - count() const - { return __r; } - - // 20.8.3.3 arithmetic - duration - operator+() const - { return *this; } - - duration - operator-() const - { return duration(-__r); } - - duration& - operator++() - { - ++__r; - return *this; - } - - duration - operator++(int) - { return duration(__r++); } - - duration& - operator--() - { - --__r; - return *this; - } - - duration - operator--(int) - { return duration(__r--); } - - duration& - operator+=(const duration& __d) - { - __r += __d.count(); - return *this; - } - - duration& - operator-=(const duration& __d) - { - __r -= __d.count(); - return *this; - } - - duration& - operator*=(const rep& __rhs) - { - __r *= __rhs; - return *this; - } - - duration& - operator/=(const rep& __rhs) - { - __r /= __rhs; - return *this; - } + // 20.8.3.2 observer + constexpr rep + count() const + { return __r; } + + // 20.8.3.3 arithmetic + constexpr duration + operator+() const + { return *this; } + + constexpr duration + operator-() const + { return duration(-__r); } + + duration& + operator++() + { + ++__r; + return *this; + } + + duration + operator++(int) + { return duration(__r++); } + + duration& + operator--() + { + --__r; + return *this; + } + + duration + operator--(int) + { return duration(__r--); } + + duration& + operator+=(const duration& __d) + { + __r += __d.count(); + return *this; + } + + duration& + operator-=(const duration& __d) + { + __r -= __d.count(); + return *this; + } + + duration& + operator*=(const rep& __rhs) + { + __r *= __rhs; + return *this; + } + + duration& + operator/=(const rep& __rhs) + { + __r /= __rhs; + return *this; + } // DR 934. template<typename _Rep2 = rep> @@ -312,46 +316,45 @@ namespace std return *this; } - // 20.8.3.4 special values - // TODO: These should be constexprs. - static const duration - zero() - { return duration(duration_values<rep>::zero()); } + // 20.8.3.4 special values + static constexpr duration + zero() + { return duration(duration_values<rep>::zero()); } + + static constexpr duration + min() + { return duration(duration_values<rep>::min()); } - static const duration - min() - { return duration(duration_values<rep>::min()); } - - static const duration - max() - { return duration(duration_values<rep>::max()); } + static constexpr duration + max() + { return duration(duration_values<rep>::max()); } private: - rep __r; + rep __r; }; template<typename _Rep1, typename _Period1, - typename _Rep2, typename _Period2> - inline typename common_type<duration<_Rep1, _Period1>, - duration<_Rep2, _Period2>>::type - operator+(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + typename _Rep2, typename _Period2> + inline typename common_type<duration<_Rep1, _Period1>, + duration<_Rep2, _Period2>>::type + operator+(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { - typedef typename common_type<duration<_Rep1, _Period1>, - duration<_Rep2, _Period2>>::type __ct; - return __ct(__lhs) += __rhs; + typedef typename common_type<duration<_Rep1, _Period1>, + duration<_Rep2, _Period2>>::type __ct; + return __ct(__lhs) += __rhs; } - template<typename _Rep1, typename _Period1, - typename _Rep2, typename _Period2> - inline typename common_type<duration<_Rep1, _Period1>, - duration<_Rep2, _Period2>>::type - operator-(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + template<typename _Rep1, typename _Period1, + typename _Rep2, typename _Period2> + inline typename common_type<duration<_Rep1, _Period1>, + duration<_Rep2, _Period2>>::type + operator-(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { - typedef typename common_type<duration<_Rep1, _Period1>, - duration<_Rep2, _Period2>>::type __ct; - return __ct(__lhs) -= __rhs; + typedef typename common_type<duration<_Rep1, _Period1>, + duration<_Rep2, _Period2>>::type __ct; + return __ct(__lhs) -= __rhs; } template<typename _Rep1, typename _Rep2, bool = @@ -361,21 +364,21 @@ namespace std template<typename _Rep1, typename _Rep2> struct __common_rep_type<_Rep1, _Rep2, true> - { typedef typename common_type<_Rep1, _Rep2>::type type; }; + { typedef typename common_type<_Rep1, _Rep2>::type type; }; template<typename _Rep1, typename _Period, typename _Rep2> inline duration<typename __common_rep_type<_Rep1, _Rep2>::type, _Period> operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { - typedef typename common_type<_Rep1, _Rep2>::type __cr; - return duration<__cr, _Period>(__d) *= __s; + typedef typename common_type<_Rep1, _Rep2>::type __cr; + return duration<__cr, _Period>(__d) *= __s; } template<typename _Rep1, typename _Period, typename _Rep2> inline duration<typename __common_rep_type<_Rep2, _Rep1>::type, _Period> operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) { return __d * __s; } - + template<typename _Rep1, typename _Period, typename _Rep2> inline duration<typename __common_rep_type<_Rep1, typename enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period> @@ -388,12 +391,12 @@ namespace std template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> inline typename common_type<_Rep1, _Rep2>::type - operator/(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + operator/(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { - typedef typename common_type<duration<_Rep1, _Period1>, - duration<_Rep2, _Period2>>::type __ct; - return __ct(__lhs).count() / __ct(__rhs).count(); + typedef typename common_type<duration<_Rep1, _Period1>, + duration<_Rep2, _Period2>>::type __ct; + return __ct(__lhs).count() / __ct(__rhs).count(); } // DR 934. @@ -408,112 +411,112 @@ namespace std template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> - inline typename common_type<duration<_Rep1, _Period1>, - duration<_Rep2, _Period2>>::type - operator%(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + inline typename common_type<duration<_Rep1, _Period1>, + duration<_Rep2, _Period2>>::type + operator%(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { - typedef typename common_type<duration<_Rep1, _Period1>, - duration<_Rep2, _Period2>>::type __ct; - return __ct(__lhs) %= __rhs; + typedef typename common_type<duration<_Rep1, _Period1>, + duration<_Rep2, _Period2>>::type __ct; + return __ct(__lhs) %= __rhs; } // comparisons template<typename _Rep1, typename _Period1, - typename _Rep2, typename _Period2> - inline bool - operator==(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + typename _Rep2, typename _Period2> + inline constexpr bool + operator==(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { - typedef typename common_type<duration<_Rep1, _Period1>, - duration<_Rep2, _Period2>>::type __ct; - return __ct(__lhs).count() == __ct(__rhs).count(); + typedef typename common_type<duration<_Rep1, _Period1>, + duration<_Rep2, _Period2>>::type __ct; + return __ct(__lhs).count() == __ct(__rhs).count(); } template<typename _Rep1, typename _Period1, - typename _Rep2, typename _Period2> - inline bool - operator<(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + typename _Rep2, typename _Period2> + inline constexpr bool + operator<(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { - typedef typename common_type<duration<_Rep1, _Period1>, - duration<_Rep2, _Period2>>::type __ct; - return __ct(__lhs).count() < __ct(__rhs).count(); + typedef typename common_type<duration<_Rep1, _Period1>, + duration<_Rep2, _Period2>>::type __ct; + return __ct(__lhs).count() < __ct(__rhs).count(); } template<typename _Rep1, typename _Period1, - typename _Rep2, typename _Period2> - inline bool - operator!=(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + typename _Rep2, typename _Period2> + inline constexpr bool + operator!=(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { return !(__lhs == __rhs); } template<typename _Rep1, typename _Period1, - typename _Rep2, typename _Period2> - inline bool - operator<=(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + typename _Rep2, typename _Period2> + inline constexpr bool + operator<=(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { return !(__rhs < __lhs); } template<typename _Rep1, typename _Period1, - typename _Rep2, typename _Period2> - inline bool - operator>(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + typename _Rep2, typename _Period2> + inline constexpr bool + operator>(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { return __rhs < __lhs; } - template<typename _Rep1, typename _Period1, - typename _Rep2, typename _Period2> - inline bool - operator>=(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + template<typename _Rep1, typename _Period1, + typename _Rep2, typename _Period2> + inline constexpr bool + operator>=(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { return !(__lhs < __rhs); } /// nanoseconds - typedef duration<int64_t, nano> nanoseconds; + typedef duration<int64_t, nano> nanoseconds; /// microseconds - typedef duration<int64_t, micro> microseconds; + typedef duration<int64_t, micro> microseconds; /// milliseconds - typedef duration<int64_t, milli> milliseconds; - + typedef duration<int64_t, milli> milliseconds; + /// seconds - typedef duration<int64_t > seconds; + typedef duration<int64_t> seconds; /// minutes - typedef duration<int, ratio< 60>> minutes; + typedef duration<int, ratio< 60>> minutes; /// hours - typedef duration<int, ratio<3600>> hours; + typedef duration<int, ratio<3600>> hours; /// time_point template<typename _Clock, typename _Duration> struct time_point { - typedef _Clock clock; - typedef _Duration duration; - typedef typename duration::rep rep; - typedef typename duration::period period; + typedef _Clock clock; + typedef _Duration duration; + typedef typename duration::rep rep; + typedef typename duration::period period; - time_point() : __d(duration::zero()) + constexpr time_point() : __d(duration::zero()) { } - explicit time_point(const duration& __dur) - : __d(duration::zero() + __dur) + constexpr explicit time_point(const duration& __dur) + : __d(__dur) { } // conversions template<typename _Duration2> - time_point(const time_point<clock, _Duration2>& __t) + constexpr time_point(const time_point<clock, _Duration2>& __t) : __d(__t.time_since_epoch()) { } // observer - duration + constexpr duration time_since_epoch() const { return __d; } - + // arithmetic time_point& operator+=(const duration& __dur) @@ -521,124 +524,127 @@ namespace std __d += __dur; return *this; } - + time_point& operator-=(const duration& __dur) { __d -= __dur; return *this; } - + // special values - // TODO: These should be constexprs. - static const time_point + static constexpr time_point min() { return time_point(duration::min()); } - - static const time_point + + static constexpr time_point max() { return time_point(duration::max()); } - + private: duration __d; }; - + /// time_point_cast template<typename _ToDuration, typename _Clock, typename _Duration> - inline typename enable_if<__is_duration<_ToDuration>::value, + inline constexpr typename enable_if<__is_duration<_ToDuration>::value, time_point<_Clock, _ToDuration>>::type time_point_cast(const time_point<_Clock, _Duration>& __t) { - return time_point<_Clock, _ToDuration>( - duration_cast<_ToDuration>(__t.time_since_epoch())); + return time_point<_Clock, _ToDuration>( + duration_cast<_ToDuration>(__t.time_since_epoch())); } template<typename _Clock, typename _Duration1, - typename _Rep2, typename _Period2> - inline time_point<_Clock, - typename common_type<_Duration1, duration<_Rep2, _Period2>>::type> - operator+(const time_point<_Clock, _Duration1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + typename _Rep2, typename _Period2> + inline time_point<_Clock, + typename common_type<_Duration1, duration<_Rep2, _Period2>>::type> + operator+(const time_point<_Clock, _Duration1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { - typedef time_point<_Clock, - typename common_type<_Duration1, - duration<_Rep2, _Period2>>::type> __ct; - return __ct(__lhs) += __rhs; + typedef time_point<_Clock, + typename common_type<_Duration1, + duration<_Rep2, _Period2>>::type> __ct; + return __ct(__lhs) += __rhs; } template<typename _Rep1, typename _Period1, - typename _Clock, typename _Duration2> - inline time_point<_Clock, - typename common_type<duration<_Rep1, _Period1>, _Duration2>::type> - operator+(const duration<_Rep1, _Period1>& __lhs, - const time_point<_Clock, _Duration2>& __rhs) + typename _Clock, typename _Duration2> + inline time_point<_Clock, + typename common_type<duration<_Rep1, _Period1>, _Duration2>::type> + operator+(const duration<_Rep1, _Period1>& __lhs, + const time_point<_Clock, _Duration2>& __rhs) { return __rhs + __lhs; } template<typename _Clock, typename _Duration1, - typename _Rep2, typename _Period2> - inline time_point<_Clock, - typename common_type<_Duration1, duration<_Rep2, _Period2>>::type> - operator-(const time_point<_Clock, _Duration1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) + typename _Rep2, typename _Period2> + inline time_point<_Clock, + typename common_type<_Duration1, duration<_Rep2, _Period2>>::type> + operator-(const time_point<_Clock, _Duration1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) { return __lhs + (-__rhs); } template<typename _Clock, typename _Duration1, typename _Duration2> inline typename common_type<_Duration1, _Duration2>::type - operator-(const time_point<_Clock, _Duration1>& __lhs, - const time_point<_Clock, _Duration2>& __rhs) + operator-(const time_point<_Clock, _Duration1>& __lhs, + const time_point<_Clock, _Duration2>& __rhs) { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); } template<typename _Clock, typename _Duration1, typename _Duration2> - inline bool + inline constexpr bool operator==(const time_point<_Clock, _Duration1>& __lhs, - const time_point<_Clock, _Duration2>& __rhs) + const time_point<_Clock, _Duration2>& __rhs) { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); } template<typename _Clock, typename _Duration1, typename _Duration2> - inline bool + inline constexpr bool operator!=(const time_point<_Clock, _Duration1>& __lhs, - const time_point<_Clock, _Duration2>& __rhs) + const time_point<_Clock, _Duration2>& __rhs) { return !(__lhs == __rhs); } template<typename _Clock, typename _Duration1, typename _Duration2> - inline bool + inline constexpr bool operator<(const time_point<_Clock, _Duration1>& __lhs, - const time_point<_Clock, _Duration2>& __rhs) + const time_point<_Clock, _Duration2>& __rhs) { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); } template<typename _Clock, typename _Duration1, typename _Duration2> - inline bool + inline constexpr bool operator<=(const time_point<_Clock, _Duration1>& __lhs, - const time_point<_Clock, _Duration2>& __rhs) + const time_point<_Clock, _Duration2>& __rhs) { return !(__rhs < __lhs); } template<typename _Clock, typename _Duration1, typename _Duration2> - inline bool + inline constexpr bool operator>(const time_point<_Clock, _Duration1>& __lhs, - const time_point<_Clock, _Duration2>& __rhs) + const time_point<_Clock, _Duration2>& __rhs) { return __rhs < __lhs; } template<typename _Clock, typename _Duration1, typename _Duration2> - inline bool + inline constexpr bool operator>=(const time_point<_Clock, _Duration1>& __lhs, - const time_point<_Clock, _Duration2>& __rhs) + const time_point<_Clock, _Duration2>& __rhs) { return !(__lhs < __rhs); } /// system_clock struct system_clock { #ifdef _GLIBCXX_USE_CLOCK_REALTIME - typedef chrono::nanoseconds duration; + typedef chrono::nanoseconds duration; #elif defined(_GLIBCXX_USE_GETTIMEOFDAY) - typedef chrono::microseconds duration; + typedef chrono::microseconds duration; #else - typedef chrono::seconds duration; + typedef chrono::seconds duration; #endif typedef duration::rep rep; typedef duration::period period; typedef chrono::time_point<system_clock, duration> time_point; + static_assert(system_clock::duration::min() + < system_clock::duration::zero(), + "a clock's minimum duration cannot be less than its epoch"); + static const bool is_monotonic = false; static time_point @@ -648,25 +654,17 @@ namespace std static std::time_t to_time_t(const time_point& __t) { - return std::time_t( - duration_cast<chrono::seconds>(__t.time_since_epoch()).count()); + return std::time_t( + duration_cast<chrono::seconds>(__t.time_since_epoch()).count()); } static time_point from_time_t(std::time_t __t) - { - return time_point_cast<system_clock::duration>( - chrono::time_point<system_clock, chrono::seconds>( - chrono::seconds(__t))); + { + return time_point_cast<system_clock::duration>( + chrono::time_point<system_clock, chrono::seconds>( + chrono::seconds(__t))); } - - // TODO: requires constexpr - /* - static_assert( - system_clock::duration::min() < - system_clock::duration::zero(), - "a clock's minimum duration cannot be less than its epoch"); - */ }; #ifdef _GLIBCXX_USE_CLOCK_MONOTONIC diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 9305651..6f0fe44 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -126,49 +126,49 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// Default constructor. First parameter is x, second parameter is y. /// Unspecified parameters default to 0. - complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp()) + _GLIBCXX_CONSTEXPR complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp()) : _M_real(__r), _M_imag(__i) { } // Lets the compiler synthesize the copy constructor // complex (const complex<_Tp>&); /// Copy constructor. template<typename _Up> - complex(const complex<_Up>& __z) + _GLIBCXX_CONSTEXPR complex(const complex<_Up>& __z) : _M_real(__z.real()), _M_imag(__z.imag()) { } #ifdef __GXX_EXPERIMENTAL_CXX0X__ // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. - _Tp real() const - { return _M_real; } + constexpr _Tp + real() const { return _M_real; } - _Tp imag() const - { return _M_imag; } + constexpr _Tp + imag() const { return _M_imag; } #else /// Return real part of complex number. - _Tp& real() - { return _M_real; } + _Tp& + real() { return _M_real; } /// Return real part of complex number. - const _Tp& real() const - { return _M_real; } + const _Tp& + real() const { return _M_real; } /// Return imaginary part of complex number. - _Tp& imag() - { return _M_imag; } + _Tp& + imag() { return _M_imag; } /// Return imaginary part of complex number. - const _Tp& imag() const - { return _M_imag; } + const _Tp& + imag() const { return _M_imag; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. - void real(_Tp __val) - { _M_real = __val; } + void + real(_Tp __val) { _M_real = __val; } - void imag(_Tp __val) - { _M_imag = __val; } + void + imag(_Tp __val) { _M_imag = __val; } /// Assign this complex number to scalar @a t. complex<_Tp>& operator=(const _Tp&); @@ -215,7 +215,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _Up> complex<_Tp>& operator/=(const complex<_Up>&); - const complex& __rep() const + _GLIBCXX_USE_CONSTEXPR complex __rep() const { return *this; } private: @@ -1041,46 +1041,43 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef float value_type; typedef __complex__ float _ComplexT; - complex(_ComplexT __z) : _M_value(__z) { } + _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { } - complex(float __r = 0.0f, float __i = 0.0f) - { - __real__ _M_value = __r; - __imag__ _M_value = __i; - } + _GLIBCXX_CONSTEXPR complex(float __r = 0.0f, float __i = 0.0f) + : _M_value(__r + __i * 1.0fi) { } - explicit complex(const complex<double>&); - explicit complex(const complex<long double>&); + explicit _GLIBCXX_CONSTEXPR complex(const complex<double>&); + explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&); #ifdef __GXX_EXPERIMENTAL_CXX0X__ // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. - float real() const - { return __real__ _M_value; } + constexpr float + real() const { return __real__ _M_value; } - float imag() const - { return __imag__ _M_value; } + constexpr float + imag() const { return __imag__ _M_value; } #else - float& real() - { return __real__ _M_value; } + float& + real() { return __real__ _M_value; } - const float& real() const - { return __real__ _M_value; } + const float& + real() const { return __real__ _M_value; } - float& imag() - { return __imag__ _M_value; } + float& + imag() { return __imag__ _M_value; } - const float& imag() const - { return __imag__ _M_value; } + const float& + imag() const { return __imag__ _M_value; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. - void real(float __val) - { __real__ _M_value = __val; } + void + real(float __val) { __real__ _M_value = __val; } - void imag(float __val) - { __imag__ _M_value = __val; } + void + imag(float __val) { __imag__ _M_value = __val; } complex& operator=(float __f) @@ -1170,7 +1167,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return *this; } - const _ComplexT& __rep() const { return _M_value; } + _GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; } private: _ComplexT _M_value; @@ -1184,48 +1181,45 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef double value_type; typedef __complex__ double _ComplexT; - complex(_ComplexT __z) : _M_value(__z) { } + _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { } - complex(double __r = 0.0, double __i = 0.0) - { - __real__ _M_value = __r; - __imag__ _M_value = __i; - } + _GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0) + : _M_value(__r + __i * 1.0i) { } - complex(const complex<float>& __z) + _GLIBCXX_CONSTEXPR complex(const complex<float>& __z) : _M_value(__z.__rep()) { } - explicit complex(const complex<long double>&); + explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&); #ifdef __GXX_EXPERIMENTAL_CXX0X__ // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. - double real() const - { return __real__ _M_value; } + constexpr double + real() const { return __real__ _M_value; } - double imag() const - { return __imag__ _M_value; } + constexpr double + imag() const { return __imag__ _M_value; } #else - double& real() - { return __real__ _M_value; } + double& + real() { return __real__ _M_value; } - const double& real() const - { return __real__ _M_value; } + const double& + real() const { return __real__ _M_value; } - double& imag() - { return __imag__ _M_value; } + double& + imag() { return __imag__ _M_value; } - const double& imag() const - { return __imag__ _M_value; } + const double& + imag() const { return __imag__ _M_value; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. - void real(double __val) - { __real__ _M_value = __val; } + void + real(double __val) { __real__ _M_value = __val; } - void imag(double __val) - { __imag__ _M_value = __val; } + void + imag(double __val) { __imag__ _M_value = __val; } complex& operator=(double __d) @@ -1314,7 +1308,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return *this; } - const _ComplexT& __rep() const { return _M_value; } + _GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; } private: _ComplexT _M_value; @@ -1328,49 +1322,47 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef long double value_type; typedef __complex__ long double _ComplexT; - complex(_ComplexT __z) : _M_value(__z) { } + _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { } - complex(long double __r = 0.0L, long double __i = 0.0L) - { - __real__ _M_value = __r; - __imag__ _M_value = __i; - } + _GLIBCXX_CONSTEXPR complex(long double __r = 0.0L, + long double __i = 0.0L) + : _M_value(__r + __i * 1.0Li) { } - complex(const complex<float>& __z) + _GLIBCXX_CONSTEXPR complex(const complex<float>& __z) : _M_value(__z.__rep()) { } - complex(const complex<double>& __z) + _GLIBCXX_CONSTEXPR complex(const complex<double>& __z) : _M_value(__z.__rep()) { } #ifdef __GXX_EXPERIMENTAL_CXX0X__ // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. - long double real() const - { return __real__ _M_value; } + constexpr long double + real() const { return __real__ _M_value; } - long double imag() const - { return __imag__ _M_value; } + constexpr long double + imag() const { return __imag__ _M_value; } #else - long double& real() - { return __real__ _M_value; } + long double& + real() { return __real__ _M_value; } - const long double& real() const - { return __real__ _M_value; } + const long double& + real() const { return __real__ _M_value; } - long double& imag() - { return __imag__ _M_value; } + long double& + imag() { return __imag__ _M_value; } - const long double& imag() const - { return __imag__ _M_value; } + const long double& + imag() const { return __imag__ _M_value; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. - void real(long double __val) - { __real__ _M_value = __val; } + void + real(long double __val) { __real__ _M_value = __val; } - void imag(long double __val) - { __imag__ _M_value = __val; } + void + imag(long double __val) { __imag__ _M_value = __val; } complex& operator=(long double __r) @@ -1459,7 +1451,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return *this; } - const _ComplexT& __rep() const { return _M_value; } + _GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; } private: _ComplexT _M_value; @@ -1467,15 +1459,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // These bits have to be at the end of this file, so that the // specializations have all been defined. - inline + inline _GLIBCXX_CONSTEXPR complex<float>::complex(const complex<double>& __z) : _M_value(__z.__rep()) { } - inline + inline _GLIBCXX_CONSTEXPR complex<float>::complex(const complex<long double>& __z) : _M_value(__z.__rep()) { } - inline + inline _GLIBCXX_CONSTEXPR complex<double>::complex(const complex<long double>& __z) : _M_value(__z.__rep()) { } diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 2933c8b..aff0a33 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -64,19 +64,23 @@ namespace std no_state }; + /// Specialization. template<> struct is_error_code_enum<future_errc> : public true_type { }; /// Points to a statically-allocated object derived from error_category. - extern const error_category* const future_category; + const error_category& + future_category(); - // TODO: requires constexpr - inline error_code make_error_code(future_errc __errc) - { return error_code(static_cast<int>(__errc), *future_category); } + /// Overload for make_error_code. + inline error_code + make_error_code(future_errc __errc) + { return error_code(static_cast<int>(__errc), future_category()); } - // TODO: requires constexpr - inline error_condition make_error_condition(future_errc __errc) - { return error_condition(static_cast<int>(__errc), *future_category); } + /// Overload for make_error_condition. + inline error_condition + make_error_condition(future_errc __errc) + { return error_condition(static_cast<int>(__errc), future_category()); } /** * @brief Exception type thrown by futures. @@ -116,7 +120,21 @@ namespace std template<typename _Res> class promise; - enum class launch { any, async, sync }; + /// Launch code for futures + enum class launch + { + any, + async, + sync + }; + + /// Status code for futures + enum class future_status + { + ready, + timeout, + deferred + }; template<typename _Fn, typename... _Args> future<typename result_of<_Fn(_Args...)>::type> @@ -1242,6 +1260,7 @@ namespace std } }; + /// swap template<typename _Res, typename... _ArgTypes> inline void swap(packaged_task<_Res(_ArgTypes...)>& __x, @@ -1307,6 +1326,7 @@ namespace std thread _M_thread; }; + /// async template<typename _Fn, typename... _Args> future<typename result_of<_Fn(_Args...)>::type> async(launch __policy, _Fn&& __fn, _Args&&... __args) @@ -1328,6 +1348,7 @@ namespace std return future<result_type>(__state); } + /// async, potential overload template<typename _Fn, typename... _Args> inline typename enable_if<!is_same<typename decay<_Fn>::type, launch>::value, diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits index 65b623e..ce557d6 100644 --- a/libstdc++-v3/include/std/limits +++ b/libstdc++-v3/include/std/limits @@ -1,4 +1,4 @@ -// The template and inlines for the numeric_limits classes. -*- C++ -*- +// The template and inlines for the numeric_limits classes. -*- C++ -*- // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, // 2008, 2009, 2010 Free Software Foundation, Inc. @@ -47,7 +47,7 @@ // of fundamental arithmetic data types (integers and floating points). // From Standard C++ point of view, there are 14 such types: // * integers -// bool (1) +// bool (1) // char, signed char, unsigned char, wchar_t (4) // short, unsigned short (2) // int, unsigned (2) @@ -190,83 +190,101 @@ _GLIBCXX_BEGIN_NAMESPACE(std) struct __numeric_limits_base { /** This will be true for all fundamental types (which have - specializations), and false for everything else. */ - static const bool is_specialized = false; + specializations), and false for everything else. */ + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false; /** The number of @c radix digits that be represented without change: for - integer types, the number of non-sign bits in the mantissa; for - floating types, the number of @c radix digits in the mantissa. */ - static const int digits = 0; + integer types, the number of non-sign bits in the mantissa; for + floating types, the number of @c radix digits in the mantissa. */ + static _GLIBCXX_USE_CONSTEXPR int digits = 0; + /** The number of base 10 digits that can be represented without change. */ - static const int digits10 = 0; + static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; + #ifdef __GXX_EXPERIMENTAL_CXX0X__ /** The number of base 10 digits required to ensure that values which differ are always differentiated. */ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif + /** True if the type is signed. */ - static const bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + /** True if the type is integer. * Is this supposed to be <em>if the type is integral?</em> */ - static const bool is_integer = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + /** True if the type uses an exact representation. <em>All integer types are - exact, but not all exact types are integer. For example, rational and - fixed-exponent representations are exact but not integer.</em> - [18.2.1.2]/15 */ - static const bool is_exact = false; + exact, but not all exact types are integer. For example, rational and + fixed-exponent representations are exact but not integer.</em> + [18.2.1.2]/15 */ + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + /** For integer types, specifies the base of the representation. For - floating types, specifies the base of the exponent representation. */ - static const int radix = 0; + floating types, specifies the base of the exponent representation. */ + static _GLIBCXX_USE_CONSTEXPR int radix = 0; /** The minimum negative integer such that @c radix raised to the power of - (one less than that integer) is a normalized floating point number. */ - static const int min_exponent = 0; + (one less than that integer) is a normalized floating point number. */ + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + /** The minimum negative integer such that 10 raised to that power is in - the range of normalized floating point numbers. */ - static const int min_exponent10 = 0; + the range of normalized floating point numbers. */ + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + /** The maximum positive integer such that @c radix raised to the power of - (one less than that integer) is a representable finite floating point + (one less than that integer) is a representable finite floating point number. */ - static const int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + /** The maximum positive integer such that 10 raised to that power is in - the range of representable finite floating point numbers. */ - static const int max_exponent10 = 0; + the range of representable finite floating point numbers. */ + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; /** True if the type has a representation for positive infinity. */ - static const bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + /** True if the type has a representation for a quiet (non-signaling) - <em>Not a Number</em>. */ - static const bool has_quiet_NaN = false; + <em>Not a Number</em>. */ + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + /** True if the type has a representation for a signaling - <em>Not a Number</em>. */ - static const bool has_signaling_NaN = false; + <em>Not a Number</em>. */ + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + /** See std::float_denorm_style for more information. */ - static const float_denorm_style has_denorm = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; + /** <em>True if loss of accuracy is detected as a denormalization loss, - rather than as an inexact result.</em> [18.2.1.2]/42 */ - static const bool has_denorm_loss = false; + rather than as an inexact result.</em> [18.2.1.2]/42 */ + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; /** True if-and-only-if the type adheres to the IEC 559 standard, also - known as IEEE 754. (Only makes sense for floating point types.) */ - static const bool is_iec559 = false; + known as IEEE 754. (Only makes sense for floating point types.) */ + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + /** <em>True if the set of values representable by the type is - finite. All built-in types are bounded, this member would be - false for arbitrary precision types.</em> [18.2.1.2]/54 */ - static const bool is_bounded = false; + finite. All built-in types are bounded, this member would be + false for arbitrary precision types.</em> [18.2.1.2]/54 */ + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false; + /** True if the type is @e modulo, that is, if it is possible to add two - positive numbers and have a result that wraps around to a third number - that is less. Typically false for floating types, true for unsigned - integers, and true for signed integers. */ - static const bool is_modulo = false; + positive numbers and have a result that wraps around to a third number + that is less. Typically false for floating types, true for unsigned + integers, and true for signed integers. */ + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; /** True if trapping is implemented for this type. */ - static const bool traps = false; + static _GLIBCXX_USE_CONSTEXPR bool traps = false; + /** True if tininess is detected before rounding. (see IEC 559) */ - static const bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + /** See std::float_round_style for more information. This is only - meaningful for floating types; integer types will all be + meaningful for floating types; integer types will all be round_toward_zero. */ - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = + round_toward_zero; }; /** @@ -284,33 +302,49 @@ _GLIBCXX_BEGIN_NAMESPACE(std) struct numeric_limits : public __numeric_limits_base { /** The minimum finite value, or for floating types with - denormalization, the minimum positive normalized value. */ - static _Tp min() throw() { return static_cast<_Tp>(0); } + denormalization, the minimum positive normalized value. */ + static _GLIBCXX_CONSTEXPR _Tp + min() throw() { return static_cast<_Tp>(0); } + /** The maximum finite value. */ - static _Tp max() throw() { return static_cast<_Tp>(0); } + static _GLIBCXX_CONSTEXPR _Tp + max() throw() { return static_cast<_Tp>(0); } + #ifdef __GXX_EXPERIMENTAL_CXX0X__ /** A finite value x such that there is no other finite value y * where y < x. */ - static _Tp lowest() throw() { return static_cast<_Tp>(0); } + static constexpr _Tp + lowest() throw() { return static_cast<_Tp>(0); } #endif + /** The @e machine @e epsilon: the difference between 1 and the least - value greater than 1 that is representable. */ - static _Tp epsilon() throw() { return static_cast<_Tp>(0); } + value greater than 1 that is representable. */ + static _GLIBCXX_CONSTEXPR _Tp + epsilon() throw() { return static_cast<_Tp>(0); } + /** The maximum rounding error measurement (see LIA-1). */ - static _Tp round_error() throw() { return static_cast<_Tp>(0); } + static _GLIBCXX_CONSTEXPR _Tp + round_error() throw() { return static_cast<_Tp>(0); } + /** The representation of positive infinity, if @c has_infinity. */ - static _Tp infinity() throw() { return static_cast<_Tp>(0); } + static _GLIBCXX_CONSTEXPR _Tp + infinity() throw() { return static_cast<_Tp>(0); } - /** The representation of a quiet <em>Not a Number</em>, + /** The representation of a quiet <em>Not a Number</em>, if @c has_quiet_NaN. */ - static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); } + static _GLIBCXX_CONSTEXPR _Tp + quiet_NaN() throw() { return static_cast<_Tp>(0); } + /** The representation of a signaling <em>Not a Number</em>, if - @c has_signaling_NaN. */ - static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); } + @c has_signaling_NaN. */ + static _GLIBCXX_CONSTEXPR _Tp + signaling_NaN() throw() { return static_cast<_Tp>(0); } + /** The minimum positive denormalized value. For types where - @c has_denorm is false, this is the minimum positive normalized + @c has_denorm is false, this is the minimum positive normalized value. */ - static _Tp denorm_min() throw() { return static_cast<_Tp>(0); } + static _GLIBCXX_CONSTEXPR _Tp + denorm_min() throw() { return static_cast<_Tp>(0); } }; #ifdef __GXX_EXPERIMENTAL_CXX0X__ @@ -334,292 +368,341 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<> struct numeric_limits<bool> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR bool + min() throw() { return false; } + + static _GLIBCXX_CONSTEXPR bool + max() throw() { return true; } - static bool min() throw() - { return false; } - static bool max() throw() - { return true; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static bool lowest() throw() - { return min(); } + static constexpr bool + lowest() throw() { return min(); } #endif - static const int digits = 1; - static const int digits10 = 0; + static _GLIBCXX_USE_CONSTEXPR int digits = 1; + static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static bool epsilon() throw() - { return false; } - static bool round_error() throw() - { return false; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static bool infinity() throw() - { return false; } - static bool quiet_NaN() throw() - { return false; } - static bool signaling_NaN() throw() - { return false; } - static bool denorm_min() throw() - { return false; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = false; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR bool + epsilon() throw() { return false; } + + static _GLIBCXX_CONSTEXPR bool + round_error() throw() { return false; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR bool + infinity() throw() { return false; } + + static _GLIBCXX_CONSTEXPR bool + quiet_NaN() throw() { return false; } + + static _GLIBCXX_CONSTEXPR bool + signaling_NaN() throw() { return false; } + + static _GLIBCXX_CONSTEXPR bool + denorm_min() throw() { return false; } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; // It is not clear what it means for a boolean type to trap. // This is a DR on the LWG issue list. Here, I use integer // promotion semantics. - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<char> specialization. template<> struct numeric_limits<char> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR char + min() throw() { return __glibcxx_min(char); } + + static _GLIBCXX_CONSTEXPR char + max() throw() { return __glibcxx_max(char); } - static char min() throw() - { return __glibcxx_min(char); } - static char max() throw() - { return __glibcxx_max(char); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static char lowest() throw() - { return min(); } + static constexpr char + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (char); - static const int digits10 = __glibcxx_digits10 (char); + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char); + static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = __glibcxx_signed (char); - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static char epsilon() throw() - { return 0; } - static char round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static char infinity() throw() - { return char(); } - static char quiet_NaN() throw() - { return char(); } - static char signaling_NaN() throw() - { return char(); } - static char denorm_min() throw() - { return static_cast<char>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char); + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR char + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR char + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR + char infinity() throw() { return char(); } + + static _GLIBCXX_CONSTEXPR char + quiet_NaN() throw() { return char(); } + + static _GLIBCXX_CONSTEXPR char + signaling_NaN() throw() { return char(); } + + static _GLIBCXX_CONSTEXPR char + denorm_min() throw() { return static_cast<char>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<signed char> specialization. template<> struct numeric_limits<signed char> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR signed char + min() throw() { return -__SCHAR_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR signed char + max() throw() { return __SCHAR_MAX__; } - static signed char min() throw() - { return -__SCHAR_MAX__ - 1; } - static signed char max() throw() - { return __SCHAR_MAX__; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static signed char lowest() throw() - { return min(); } + static constexpr signed char + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (signed char); - static const int digits10 = __glibcxx_digits10 (signed char); + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (signed char); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static signed char epsilon() throw() - { return 0; } - static signed char round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static signed char infinity() throw() - { return static_cast<signed char>(0); } - static signed char quiet_NaN() throw() - { return static_cast<signed char>(0); } - static signed char signaling_NaN() throw() - { return static_cast<signed char>(0); } - static signed char denorm_min() throw() - { return static_cast<signed char>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR signed char + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR signed char + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR signed char + infinity() throw() { return static_cast<signed char>(0); } + + static _GLIBCXX_CONSTEXPR signed char + quiet_NaN() throw() { return static_cast<signed char>(0); } + + static _GLIBCXX_CONSTEXPR signed char + signaling_NaN() throw() { return static_cast<signed char>(0); } + + static _GLIBCXX_CONSTEXPR signed char + denorm_min() throw() { return static_cast<signed char>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<unsigned char> specialization. template<> struct numeric_limits<unsigned char> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned char + min() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned char + max() throw() { return __SCHAR_MAX__ * 2U + 1; } - static unsigned char min() throw() - { return 0; } - static unsigned char max() throw() - { return __SCHAR_MAX__ * 2U + 1; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static unsigned char lowest() throw() - { return min(); } + static constexpr unsigned char + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (unsigned char); - static const int digits10 = __glibcxx_digits10 (unsigned char); + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned char); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned char); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned char epsilon() throw() - { return 0; } - static unsigned char round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned char infinity() throw() - { return static_cast<unsigned char>(0); } - static unsigned char quiet_NaN() throw() - { return static_cast<unsigned char>(0); } - static unsigned char signaling_NaN() throw() - { return static_cast<unsigned char>(0); } - static unsigned char denorm_min() throw() - { return static_cast<unsigned char>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned char + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned char + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned char + infinity() throw() { return static_cast<unsigned char>(0); } + + static _GLIBCXX_CONSTEXPR unsigned char + quiet_NaN() throw() { return static_cast<unsigned char>(0); } + + static _GLIBCXX_CONSTEXPR unsigned char + signaling_NaN() throw() { return static_cast<unsigned char>(0); } + + static _GLIBCXX_CONSTEXPR unsigned char + denorm_min() throw() { return static_cast<unsigned char>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<wchar_t> specialization. template<> struct numeric_limits<wchar_t> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR wchar_t + min() throw() { return __glibcxx_min (wchar_t); } + + static _GLIBCXX_CONSTEXPR wchar_t + max() throw() { return __glibcxx_max (wchar_t); } - static wchar_t min() throw() - { return __glibcxx_min (wchar_t); } - static wchar_t max() throw() - { return __glibcxx_max (wchar_t); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static wchar_t lowest() throw() - { return min(); } + static constexpr wchar_t + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (wchar_t); - static const int digits10 = __glibcxx_digits10 (wchar_t); + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (wchar_t); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = __glibcxx_signed (wchar_t); - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static wchar_t epsilon() throw() - { return 0; } - static wchar_t round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static wchar_t infinity() throw() - { return wchar_t(); } - static wchar_t quiet_NaN() throw() - { return wchar_t(); } - static wchar_t signaling_NaN() throw() - { return wchar_t(); } - static wchar_t denorm_min() throw() - { return wchar_t(); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t); + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR wchar_t + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR wchar_t + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR wchar_t + infinity() throw() { return wchar_t(); } + + static _GLIBCXX_CONSTEXPR wchar_t + quiet_NaN() throw() { return wchar_t(); } + + static _GLIBCXX_CONSTEXPR wchar_t + signaling_NaN() throw() { return wchar_t(); } + + static _GLIBCXX_CONSTEXPR wchar_t + denorm_min() throw() { return wchar_t(); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; #ifdef __GXX_EXPERIMENTAL_CXX0X__ @@ -627,116 +710,139 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<> struct numeric_limits<char16_t> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR char16_t + min() throw() { return __glibcxx_min (char16_t); } + + static _GLIBCXX_CONSTEXPR char16_t + max() throw() { return __glibcxx_max (char16_t); } - static char16_t min() throw() - { return __glibcxx_min (char16_t); } - static char16_t max() throw() - { return __glibcxx_max (char16_t); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static char16_t lowest() throw() - { return min(); } + static constexpr char16_t + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (char16_t); - static const int digits10 = __glibcxx_digits10 (char16_t); + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (char16_t); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (char16_t); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = __glibcxx_signed (char16_t); - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static char16_t epsilon() throw() - { return 0; } - static char16_t round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static char16_t infinity() throw() - { return char16_t(); } - static char16_t quiet_NaN() throw() - { return char16_t(); } - static char16_t signaling_NaN() throw() - { return char16_t(); } - static char16_t denorm_min() throw() - { return char16_t(); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed + = __glibcxx_signed (char16_t); + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR char16_t + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR char16_t + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR char16_t + infinity() throw() { return char16_t(); } + + static _GLIBCXX_CONSTEXPR char16_t + quiet_NaN() throw() { return char16_t(); } + + static _GLIBCXX_CONSTEXPR char16_t + signaling_NaN() throw() { return char16_t(); } + + static _GLIBCXX_CONSTEXPR char16_t + denorm_min() throw() { return char16_t(); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<char32_t> specialization. template<> struct numeric_limits<char32_t> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR char32_t + min() throw() { return __glibcxx_min (char32_t); } + + static _GLIBCXX_CONSTEXPR char32_t + max() throw() { return __glibcxx_max (char32_t); } - static char32_t min() throw() - { return __glibcxx_min (char32_t); } - static char32_t max() throw() - { return __glibcxx_max (char32_t); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static char32_t lowest() throw() - { return min(); } + static constexpr char32_t + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (char32_t); - static const int digits10 = __glibcxx_digits10 (char32_t); + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char32_t); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (char32_t); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = __glibcxx_signed (char32_t); - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static char32_t epsilon() throw() - { return 0; } - static char32_t round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static char32_t infinity() throw() - { return char32_t(); } - static char32_t quiet_NaN() throw() - { return char32_t(); } - static char32_t signaling_NaN() throw() - { return char32_t(); } - static char32_t denorm_min() throw() - { return char32_t(); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed + = __glibcxx_signed (char32_t); + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR char32_t + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR char32_t + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR char32_t + infinity() throw() { return char32_t(); } + + static _GLIBCXX_CONSTEXPR char32_t + quiet_NaN() throw() { return char32_t(); } + + static _GLIBCXX_CONSTEXPR char32_t + signaling_NaN() throw() { return char32_t(); } + + static _GLIBCXX_CONSTEXPR char32_t + denorm_min() throw() { return char32_t(); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; #endif @@ -744,525 +850,617 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<> struct numeric_limits<short> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR short + min() throw() { return -__SHRT_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR short + max() throw() { return __SHRT_MAX__; } - static short min() throw() - { return -__SHRT_MAX__ - 1; } - static short max() throw() - { return __SHRT_MAX__; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static short lowest() throw() - { return min(); } + static constexpr short + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (short); - static const int digits10 = __glibcxx_digits10 (short); + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short); + static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static short epsilon() throw() - { return 0; } - static short round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static short infinity() throw() - { return short(); } - static short quiet_NaN() throw() - { return short(); } - static short signaling_NaN() throw() - { return short(); } - static short denorm_min() throw() - { return short(); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR short + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR short + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR short + infinity() throw() { return short(); } + + static _GLIBCXX_CONSTEXPR short + quiet_NaN() throw() { return short(); } + + static _GLIBCXX_CONSTEXPR short + signaling_NaN() throw() { return short(); } + + static _GLIBCXX_CONSTEXPR short + denorm_min() throw() { return short(); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<unsigned short> specialization. template<> struct numeric_limits<unsigned short> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned short + min() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned short + max() throw() { return __SHRT_MAX__ * 2U + 1; } - static unsigned short min() throw() - { return 0; } - static unsigned short max() throw() - { return __SHRT_MAX__ * 2U + 1; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static unsigned short lowest() throw() - { return min(); } + static constexpr unsigned short + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (unsigned short); - static const int digits10 = __glibcxx_digits10 (unsigned short); + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned short); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned short); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned short epsilon() throw() - { return 0; } - static unsigned short round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned short infinity() throw() - { return static_cast<unsigned short>(0); } - static unsigned short quiet_NaN() throw() - { return static_cast<unsigned short>(0); } - static unsigned short signaling_NaN() throw() - { return static_cast<unsigned short>(0); } - static unsigned short denorm_min() throw() - { return static_cast<unsigned short>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned short + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned short + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned short + infinity() throw() { return static_cast<unsigned short>(0); } + + static _GLIBCXX_CONSTEXPR unsigned short + quiet_NaN() throw() { return static_cast<unsigned short>(0); } + + static _GLIBCXX_CONSTEXPR unsigned short + signaling_NaN() throw() { return static_cast<unsigned short>(0); } + + static _GLIBCXX_CONSTEXPR unsigned short + denorm_min() throw() { return static_cast<unsigned short>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<int> specialization. template<> struct numeric_limits<int> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR int + min() throw() { return -__INT_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR int + max() throw() { return __INT_MAX__; } - static int min() throw() - { return -__INT_MAX__ - 1; } - static int max() throw() - { return __INT_MAX__; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static int lowest() throw() - { return min(); } + static constexpr int + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (int); - static const int digits10 = __glibcxx_digits10 (int); + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int); + static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static int epsilon() throw() - { return 0; } - static int round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static int infinity() throw() - { return static_cast<int>(0); } - static int quiet_NaN() throw() - { return static_cast<int>(0); } - static int signaling_NaN() throw() - { return static_cast<int>(0); } - static int denorm_min() throw() - { return static_cast<int>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR int + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR int + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR int + infinity() throw() { return static_cast<int>(0); } + + static _GLIBCXX_CONSTEXPR int + quiet_NaN() throw() { return static_cast<int>(0); } + + static _GLIBCXX_CONSTEXPR int + signaling_NaN() throw() { return static_cast<int>(0); } + + static _GLIBCXX_CONSTEXPR int + denorm_min() throw() { return static_cast<int>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<unsigned int> specialization. template<> struct numeric_limits<unsigned int> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned int + min() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned int + max() throw() { return __INT_MAX__ * 2U + 1; } - static unsigned int min() throw() - { return 0; } - static unsigned int max() throw() - { return __INT_MAX__ * 2U + 1; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static unsigned int lowest() throw() - { return min(); } + static constexpr unsigned int + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (unsigned int); - static const int digits10 = __glibcxx_digits10 (unsigned int); + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned int); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned int); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned int epsilon() throw() - { return 0; } - static unsigned int round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned int infinity() throw() - { return static_cast<unsigned int>(0); } - static unsigned int quiet_NaN() throw() - { return static_cast<unsigned int>(0); } - static unsigned int signaling_NaN() throw() - { return static_cast<unsigned int>(0); } - static unsigned int denorm_min() throw() - { return static_cast<unsigned int>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned int + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned int + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned int + infinity() throw() { return static_cast<unsigned int>(0); } + + static _GLIBCXX_CONSTEXPR unsigned int + quiet_NaN() throw() { return static_cast<unsigned int>(0); } + + static _GLIBCXX_CONSTEXPR unsigned int + signaling_NaN() throw() { return static_cast<unsigned int>(0); } + + static _GLIBCXX_CONSTEXPR unsigned int + denorm_min() throw() { return static_cast<unsigned int>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<long> specialization. template<> struct numeric_limits<long> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR long + min() throw() { return -__LONG_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR long + max() throw() { return __LONG_MAX__; } - static long min() throw() - { return -__LONG_MAX__ - 1; } - static long max() throw() - { return __LONG_MAX__; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static long lowest() throw() - { return min(); } + static constexpr long + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (long); - static const int digits10 = __glibcxx_digits10 (long); + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long); + static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static long epsilon() throw() - { return 0; } - static long round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static long infinity() throw() - { return static_cast<long>(0); } - static long quiet_NaN() throw() - { return static_cast<long>(0); } - static long signaling_NaN() throw() - { return static_cast<long>(0); } - static long denorm_min() throw() - { return static_cast<long>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR long + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR long + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR long + infinity() throw() { return static_cast<long>(0); } + + static _GLIBCXX_CONSTEXPR long + quiet_NaN() throw() { return static_cast<long>(0); } + + static _GLIBCXX_CONSTEXPR long + signaling_NaN() throw() { return static_cast<long>(0); } + + static _GLIBCXX_CONSTEXPR long + denorm_min() throw() { return static_cast<long>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<unsigned long> specialization. template<> struct numeric_limits<unsigned long> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned long + min() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned long + max() throw() { return __LONG_MAX__ * 2UL + 1; } - static unsigned long min() throw() - { return 0; } - static unsigned long max() throw() - { return __LONG_MAX__ * 2UL + 1; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static unsigned long lowest() throw() - { return min(); } + static constexpr unsigned long + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (unsigned long); - static const int digits10 = __glibcxx_digits10 (unsigned long); + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned long); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned long); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned long epsilon() throw() - { return 0; } - static unsigned long round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned long infinity() throw() - { return static_cast<unsigned long>(0); } - static unsigned long quiet_NaN() throw() - { return static_cast<unsigned long>(0); } - static unsigned long signaling_NaN() throw() - { return static_cast<unsigned long>(0); } - static unsigned long denorm_min() throw() - { return static_cast<unsigned long>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned long + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned long + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned long + infinity() throw() { return static_cast<unsigned long>(0); } + + static _GLIBCXX_CONSTEXPR unsigned long + quiet_NaN() throw() { return static_cast<unsigned long>(0); } + + static _GLIBCXX_CONSTEXPR unsigned long + signaling_NaN() throw() { return static_cast<unsigned long>(0); } + + static _GLIBCXX_CONSTEXPR unsigned long + denorm_min() throw() { return static_cast<unsigned long>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<long long> specialization. template<> struct numeric_limits<long long> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR long long + min() throw() { return -__LONG_LONG_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR long long + max() throw() { return __LONG_LONG_MAX__; } - static long long min() throw() - { return -__LONG_LONG_MAX__ - 1; } - static long long max() throw() - { return __LONG_LONG_MAX__; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static long long lowest() throw() - { return min(); } + static constexpr long long + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (long long); - static const int digits10 = __glibcxx_digits10 (long long); + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (long long); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (long long); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static long long epsilon() throw() - { return 0; } - static long long round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static long long infinity() throw() - { return static_cast<long long>(0); } - static long long quiet_NaN() throw() - { return static_cast<long long>(0); } - static long long signaling_NaN() throw() - { return static_cast<long long>(0); } - static long long denorm_min() throw() - { return static_cast<long long>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR long long + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR long long + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR long long + infinity() throw() { return static_cast<long long>(0); } + + static _GLIBCXX_CONSTEXPR long long + quiet_NaN() throw() { return static_cast<long long>(0); } + + static _GLIBCXX_CONSTEXPR long long + signaling_NaN() throw() { return static_cast<long long>(0); } + + static _GLIBCXX_CONSTEXPR long long + denorm_min() throw() { return static_cast<long long>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<unsigned long long> specialization. template<> struct numeric_limits<unsigned long long> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned long long + min() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned long long + max() throw() { return __LONG_LONG_MAX__ * 2ULL + 1; } - static unsigned long long min() throw() - { return 0; } - static unsigned long long max() throw() - { return __LONG_LONG_MAX__ * 2ULL + 1; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static unsigned long long lowest() throw() - { return min(); } + static constexpr unsigned long long + lowest() throw() { return min(); } #endif - static const int digits = __glibcxx_digits (unsigned long long); - static const int digits10 = __glibcxx_digits10 (unsigned long long); + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned long long); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned long long); #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 = 0; + static constexpr int max_digits10 = 0; #endif - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned long long epsilon() throw() - { return 0; } - static unsigned long long round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned long long infinity() throw() - { return static_cast<unsigned long long>(0); } - static unsigned long long quiet_NaN() throw() - { return static_cast<unsigned long long>(0); } - static unsigned long long signaling_NaN() throw() - { return static_cast<unsigned long long>(0); } - static unsigned long long denorm_min() throw() - { return static_cast<unsigned long long>(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned long long + epsilon() throw() { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned long long + round_error() throw() { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned long long + infinity() throw() { return static_cast<unsigned long long>(0); } + + static _GLIBCXX_CONSTEXPR unsigned long long + quiet_NaN() throw() { return static_cast<unsigned long long>(0); } + + static _GLIBCXX_CONSTEXPR unsigned long long + signaling_NaN() throw() { return static_cast<unsigned long long>(0); } + + static _GLIBCXX_CONSTEXPR unsigned long long + denorm_min() throw() { return static_cast<unsigned long long>(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; }; /// numeric_limits<float> specialization. template<> struct numeric_limits<float> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR float + min() throw() { return __FLT_MIN__; } + + static _GLIBCXX_CONSTEXPR float + max() throw() { return __FLT_MAX__; } - static float min() throw() - { return __FLT_MIN__; } - static float max() throw() - { return __FLT_MAX__; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static float lowest() throw() - { return -__FLT_MAX__; } + static constexpr float + lowest() throw() { return -__FLT_MAX__; } #endif - static const int digits = __FLT_MANT_DIG__; - static const int digits10 = __FLT_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__; #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 + static constexpr int max_digits10 = __glibcxx_max_digits10 (__FLT_MANT_DIG__); #endif - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = __FLT_RADIX__; - static float epsilon() throw() - { return __FLT_EPSILON__; } - static float round_error() throw() - { return 0.5F; } - - static const int min_exponent = __FLT_MIN_EXP__; - static const int min_exponent10 = __FLT_MIN_10_EXP__; - static const int max_exponent = __FLT_MAX_EXP__; - static const int max_exponent10 = __FLT_MAX_10_EXP__; - - static const bool has_infinity = __FLT_HAS_INFINITY__; - static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; - static const bool has_signaling_NaN = has_quiet_NaN; - static const float_denorm_style has_denorm + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; + + static _GLIBCXX_CONSTEXPR float + epsilon() throw() { return __FLT_EPSILON__; } + + static _GLIBCXX_CONSTEXPR float + round_error() throw() { return 0.5F; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; - static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss; - - static float infinity() throw() - { return __builtin_huge_valf (); } - static float quiet_NaN() throw() - { return __builtin_nanf (""); } - static float signaling_NaN() throw() - { return __builtin_nansf (""); } - static float denorm_min() throw() - { return __FLT_DENORM_MIN__; } - - static const bool is_iec559 - = has_infinity && has_quiet_NaN && has_denorm == denorm_present; - static const bool is_bounded = true; - static const bool is_modulo = false; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss + = __glibcxx_float_has_denorm_loss; + + static _GLIBCXX_CONSTEXPR float + infinity() throw() { return __builtin_huge_valf (); } - static const bool traps = __glibcxx_float_traps; - static const bool tinyness_before = __glibcxx_float_tinyness_before; - static const float_round_style round_style = round_to_nearest; + static _GLIBCXX_CONSTEXPR float + quiet_NaN() throw() { return __builtin_nanf (""); } + + static _GLIBCXX_CONSTEXPR float + signaling_NaN() throw() { return __builtin_nansf (""); } + + static _GLIBCXX_CONSTEXPR float + denorm_min() throw() { return __FLT_DENORM_MIN__; } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before + = __glibcxx_float_tinyness_before; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_to_nearest; }; #undef __glibcxx_float_has_denorm_loss @@ -1273,61 +1471,71 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<> struct numeric_limits<double> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR double + min() throw() { return __DBL_MIN__; } + + static _GLIBCXX_CONSTEXPR double + max() throw() { return __DBL_MAX__; } - static double min() throw() - { return __DBL_MIN__; } - static double max() throw() - { return __DBL_MAX__; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static double lowest() throw() - { return -__DBL_MAX__; } + static constexpr double + lowest() throw() { return -__DBL_MAX__; } #endif - static const int digits = __DBL_MANT_DIG__; - static const int digits10 = __DBL_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__; #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 + static constexpr int max_digits10 = __glibcxx_max_digits10 (__DBL_MANT_DIG__); #endif - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = __FLT_RADIX__; - static double epsilon() throw() - { return __DBL_EPSILON__; } - static double round_error() throw() - { return 0.5; } - - static const int min_exponent = __DBL_MIN_EXP__; - static const int min_exponent10 = __DBL_MIN_10_EXP__; - static const int max_exponent = __DBL_MAX_EXP__; - static const int max_exponent10 = __DBL_MAX_10_EXP__; - - static const bool has_infinity = __DBL_HAS_INFINITY__; - static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; - static const bool has_signaling_NaN = has_quiet_NaN; - static const float_denorm_style has_denorm + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; + + static _GLIBCXX_CONSTEXPR double + epsilon() throw() { return __DBL_EPSILON__; } + + static _GLIBCXX_CONSTEXPR double + round_error() throw() { return 0.5; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; - static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss; - - static double infinity() throw() - { return __builtin_huge_val(); } - static double quiet_NaN() throw() - { return __builtin_nan (""); } - static double signaling_NaN() throw() - { return __builtin_nans (""); } - static double denorm_min() throw() - { return __DBL_DENORM_MIN__; } - - static const bool is_iec559 - = has_infinity && has_quiet_NaN && has_denorm == denorm_present; - static const bool is_bounded = true; - static const bool is_modulo = false; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss + = __glibcxx_double_has_denorm_loss; + + static _GLIBCXX_CONSTEXPR double + infinity() throw() { return __builtin_huge_val(); } + + static _GLIBCXX_CONSTEXPR double + quiet_NaN() throw() { return __builtin_nan (""); } - static const bool traps = __glibcxx_double_traps; - static const bool tinyness_before = __glibcxx_double_tinyness_before; - static const float_round_style round_style = round_to_nearest; + static _GLIBCXX_CONSTEXPR double + signaling_NaN() throw() { return __builtin_nans (""); } + + static _GLIBCXX_CONSTEXPR double + denorm_min() throw() { return __DBL_DENORM_MIN__; } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before + = __glibcxx_double_tinyness_before; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_to_nearest; }; #undef __glibcxx_double_has_denorm_loss @@ -1338,62 +1546,71 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<> struct numeric_limits<long double> { - static const bool is_specialized = true; + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR long double + min() throw() { return __LDBL_MIN__; } + + static _GLIBCXX_CONSTEXPR long double + max() throw() { return __LDBL_MAX__; } - static long double min() throw() - { return __LDBL_MIN__; } - static long double max() throw() - { return __LDBL_MAX__; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static long double lowest() throw() - { return -__LDBL_MAX__; } + static constexpr long double + lowest() throw() { return -__LDBL_MAX__; } #endif - static const int digits = __LDBL_MANT_DIG__; - static const int digits10 = __LDBL_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__; #ifdef __GXX_EXPERIMENTAL_CXX0X__ - static const int max_digits10 + static _GLIBCXX_USE_CONSTEXPR int max_digits10 = __glibcxx_max_digits10 (__LDBL_MANT_DIG__); #endif - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = __FLT_RADIX__; - static long double epsilon() throw() - { return __LDBL_EPSILON__; } - static long double round_error() throw() - { return 0.5L; } - - static const int min_exponent = __LDBL_MIN_EXP__; - static const int min_exponent10 = __LDBL_MIN_10_EXP__; - static const int max_exponent = __LDBL_MAX_EXP__; - static const int max_exponent10 = __LDBL_MAX_10_EXP__; - - static const bool has_infinity = __LDBL_HAS_INFINITY__; - static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; - static const bool has_signaling_NaN = has_quiet_NaN; - static const float_denorm_style has_denorm + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; + + static _GLIBCXX_CONSTEXPR long double + epsilon() throw() { return __LDBL_EPSILON__; } + + static _GLIBCXX_CONSTEXPR long double + round_error() throw() { return 0.5L; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; - static const bool has_denorm_loss + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = __glibcxx_long_double_has_denorm_loss; - static long double infinity() throw() - { return __builtin_huge_vall (); } - static long double quiet_NaN() throw() - { return __builtin_nanl (""); } - static long double signaling_NaN() throw() - { return __builtin_nansl (""); } - static long double denorm_min() throw() - { return __LDBL_DENORM_MIN__; } + static _GLIBCXX_CONSTEXPR long double + infinity() throw() { return __builtin_huge_vall (); } - static const bool is_iec559 - = has_infinity && has_quiet_NaN && has_denorm == denorm_present; - static const bool is_bounded = true; - static const bool is_modulo = false; + static _GLIBCXX_CONSTEXPR long double + quiet_NaN() throw() { return __builtin_nanl (""); } - static const bool traps = __glibcxx_long_double_traps; - static const bool tinyness_before = __glibcxx_long_double_tinyness_before; - static const float_round_style round_style = round_to_nearest; + static _GLIBCXX_CONSTEXPR long double + signaling_NaN() throw() { return __builtin_nansl (""); } + + static _GLIBCXX_CONSTEXPR long double + denorm_min() throw() { return __LDBL_DENORM_MIN__; } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = + __glibcxx_long_double_tinyness_before; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = + round_to_nearest; }; #undef __glibcxx_long_double_has_denorm_loss diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index c11ddd4..8a27802 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -67,16 +67,15 @@ namespace std public: typedef __native_type* native_handle_type; +#ifdef __GTHREAD_MUTEX_INIT + constexpr mutex() : _M_mutex(__GTHREAD_MUTEX_INIT) { } +#else mutex() { // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may) -#ifdef __GTHREAD_MUTEX_INIT - __native_type __tmp = __GTHREAD_MUTEX_INIT; - _M_mutex = __tmp; -#else __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); -#endif } +#endif mutex(const mutex&) = delete; mutex& operator=(const mutex&) = delete; @@ -381,9 +380,9 @@ namespace std /// and manage it. struct adopt_lock_t { }; - extern const defer_lock_t defer_lock; - extern const try_to_lock_t try_to_lock; - extern const adopt_lock_t adopt_lock; + constexpr defer_lock_t defer_lock { }; + constexpr try_to_lock_t try_to_lock { }; + constexpr adopt_lock_t adopt_lock { }; /// @brief Scoped lock idiom. // Acquire the mutex here with a constructor call, then release with @@ -679,11 +678,7 @@ namespace std __native_type _M_once; public: - once_flag() - { - __native_type __tmp = __GTHREAD_ONCE_INIT; - _M_once = __tmp; - } + constexpr once_flag() : _M_once(__GTHREAD_ONCE_INIT) { } once_flag(const once_flag&) = delete; once_flag& operator=(const once_flag&) = delete; diff --git a/libstdc++-v3/include/std/ratio b/libstdc++-v3/include/std/ratio index b999e31..3688ea4 100644 --- a/libstdc++-v3/include/std/ratio +++ b/libstdc++-v3/include/std/ratio @@ -155,20 +155,20 @@ namespace std "out of range"); // Note: sign(N) * abs(N) == N - static const intmax_t num = + static constexpr intmax_t num = _Num * __static_sign<_Den>::value / __static_gcd<_Num, _Den>::value; - static const intmax_t den = + static constexpr intmax_t den = __static_abs<_Den>::value / __static_gcd<_Num, _Den>::value; typedef ratio<num, den> type; }; template<intmax_t _Num, intmax_t _Den> - const intmax_t ratio<_Num, _Den>::num; + constexpr intmax_t ratio<_Num, _Den>::num; template<intmax_t _Num, intmax_t _Den> - const intmax_t ratio<_Num, _Den>::den; + constexpr intmax_t ratio<_Num, _Den>::den; /// ratio_add template<typename _R1, typename _R2> diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 67a6eb7..d0260de 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -225,7 +225,7 @@ namespace std typedef _Tuple_impl<0, _Elements...> _Inherited; public: - tuple() + _GLIBCXX_CONSTEXPR tuple() : _Inherited() { } explicit |