From b9af2eae4a419a05b377ce0483ca1bf313f06829 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Wed, 22 Sep 2010 18:02:38 +0000 Subject: [PATCH] visibility-decoration. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114559 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/mutex | 17 +- include/new | 2 +- include/ostream | 4 +- include/queue | 85 +++-- include/random | 843 ++++++++++++++++++++++++++++++++++++------------ 5 files changed, 713 insertions(+), 238 deletions(-) diff --git a/include/mutex b/include/mutex index 8ab9c2ae..ea73d46e 100644 --- a/include/mutex +++ b/include/mutex @@ -180,7 +180,7 @@ template _LIBCPP_BEGIN_NAMESPACE_STD -class recursive_mutex +class _LIBCPP_VISIBLE recursive_mutex { pthread_mutex_t __m_; @@ -198,10 +198,11 @@ public: void unlock(); typedef pthread_mutex_t* native_handle_type; + _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} }; -class timed_mutex +class _LIBCPP_VISIBLE timed_mutex { mutex __m_; condition_variable __cv_; @@ -218,6 +219,7 @@ public: void lock(); bool try_lock(); template + _LIBCPP_INLINE_VISIBILITY bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::monotonic_clock::now() + __d);} template @@ -242,7 +244,7 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) return false; } -class recursive_timed_mutex +class _LIBCPP_VISIBLE recursive_timed_mutex { mutex __m_; condition_variable __cv_; @@ -260,6 +262,7 @@ public: void lock(); bool try_lock(); template + _LIBCPP_INLINE_VISIBILITY bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::monotonic_clock::now() + __d);} template @@ -406,7 +409,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2) } template -inline +inline _LIBCPP_INLINE_VISIBILITY void lock(_L0& __l0, _L1& __l1, _L2& ...__l2) { @@ -429,8 +432,9 @@ template #endif // _LIBCPP_HAS_NO_VARIADICS -struct once_flag +struct _LIBCPP_VISIBLE once_flag { + _LIBCPP_INLINE_VISIBILITY // constexpr once_flag() {} @@ -457,11 +461,14 @@ class __call_once_param _F __f_; public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {} #else + _LIBCPP_INLINE_VISIBILITY explicit __call_once_param(const _F& __f) : __f_(__f) {} #endif + _LIBCPP_INLINE_VISIBILITY void operator()() { __f_(); diff --git a/include/new b/include/new index 9003d351..6cc5c23b 100644 --- a/include/new +++ b/include/new @@ -81,7 +81,7 @@ public: void __throw_bad_alloc(); // not in C++ spec -struct nothrow_t {}; +struct _LIBCPP_VISIBLE nothrow_t {}; extern _LIBCPP_VISIBLE const nothrow_t nothrow; typedef void (*new_handler)(); _LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw(); diff --git a/include/ostream b/include/ostream index 7b02716d..fae9d309 100644 --- a/include/ostream +++ b/include/ostream @@ -138,7 +138,7 @@ template _LIBCPP_BEGIN_NAMESPACE_STD template -class basic_ostream +class _LIBCPP_VISIBLE basic_ostream : virtual public basic_ios<_CharT, _Traits> { public: @@ -203,7 +203,7 @@ protected: }; template -class basic_ostream<_CharT, _Traits>::sentry +class _LIBCPP_VISIBLE basic_ostream<_CharT, _Traits>::sentry { bool __ok_; basic_ostream<_CharT, _Traits>& __os_; diff --git a/include/queue b/include/queue index f5e8d264..50da437a 100644 --- a/include/queue +++ b/include/queue @@ -167,7 +167,7 @@ bool operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); template > -class queue +class _LIBCPP_VISIBLE queue { public: typedef _Container container_type; @@ -180,39 +180,49 @@ protected: container_type c; public: + _LIBCPP_INLINE_VISIBILITY queue() : c() {} + _LIBCPP_INLINE_VISIBILITY explicit queue(const container_type& __c) : c(__c) {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit queue(container_type&& __c) : c(_STD::move(__c)) {} + _LIBCPP_INLINE_VISIBILITY queue(queue&& __q) : c(_STD::move(__q.c)) {} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template + _LIBCPP_INLINE_VISIBILITY explicit queue(const _Alloc& __a, typename enable_if::value>::type* = 0) : c(__a) {} template + _LIBCPP_INLINE_VISIBILITY queue(const queue& __q, const _Alloc& __a, typename enable_if::value>::type* = 0) : c(__q.c, __a) {} template + _LIBCPP_INLINE_VISIBILITY queue(const container_type& __c, const _Alloc& __a, typename enable_if::value>::type* = 0) : c(__c, __a) {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template + _LIBCPP_INLINE_VISIBILITY queue(container_type&& __c, const _Alloc& __a, typename enable_if::value>::type* = 0) : c(_STD::move(__c), __a) {} template + _LIBCPP_INLINE_VISIBILITY queue(queue&& __q, const _Alloc& __a, typename enable_if::value>::type* = 0) : c(_STD::move(__q.c), __a) {} + _LIBCPP_INLINE_VISIBILITY queue& operator=(queue&& __q) { c = _STD::move(__q.c); @@ -220,25 +230,36 @@ public: } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} + _LIBCPP_INLINE_VISIBILITY size_type size() const {return c.size();} + _LIBCPP_INLINE_VISIBILITY reference front() {return c.front();} + _LIBCPP_INLINE_VISIBILITY const_reference front() const {return c.front();} + _LIBCPP_INLINE_VISIBILITY reference back() {return c.back();} + _LIBCPP_INLINE_VISIBILITY const_reference back() const {return c.back();} + _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v) {c.push_back(__v);} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v) {c.push_back(_STD::move(__v));} #ifndef _LIBCPP_HAS_NO_VARIADICS template + _LIBCPP_INLINE_VISIBILITY void emplace(_Args&&... __args) {c.emplace_back(_STD::forward<_Args>(__args)...);} #endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY void pop() {c.pop_front();} + _LIBCPP_INLINE_VISIBILITY void swap(queue& __q) { using _STD::swap; @@ -247,17 +268,19 @@ public: template friend + _LIBCPP_INLINE_VISIBILITY bool operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y); template friend + _LIBCPP_INLINE_VISIBILITY bool operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y); }; template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { @@ -265,7 +288,7 @@ operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { @@ -273,7 +296,7 @@ operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { @@ -281,7 +304,7 @@ operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { @@ -289,7 +312,7 @@ operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { @@ -297,7 +320,7 @@ operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { @@ -305,7 +328,7 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) } template -inline +inline _LIBCPP_INLINE_VISIBILITY void swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y) { @@ -313,14 +336,14 @@ swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y) } template -struct uses_allocator, _Alloc> +struct _LIBCPP_VISIBLE uses_allocator, _Alloc> : public uses_allocator<_Container, _Alloc> { }; template , class _Compare = less > -class priority_queue +class _LIBCPP_VISIBLE priority_queue { public: typedef _Container container_type; @@ -335,6 +358,7 @@ protected: value_compare comp; public: + _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const value_compare& __comp = value_compare()) : c(), comp(__comp) {} priority_queue(const value_compare& __comp, const container_type& __c); @@ -383,8 +407,11 @@ public: _Alloc>::value>::type* = 0); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} + _LIBCPP_INLINE_VISIBILITY size_type size() const {return c.size();} + _LIBCPP_INLINE_VISIBILITY const_reference top() const {return c.front();} void push(const value_type& __v); @@ -400,7 +427,7 @@ public: }; template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp, const container_type& __c) : c(__c), @@ -412,7 +439,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, container_type&& __c) : c(_STD::move(__c)), @@ -425,7 +452,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _ template template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp) : c(__f, __l), @@ -436,7 +463,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input template template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c) @@ -451,7 +478,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input template template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c) @@ -463,7 +490,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input } template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q) : c(_STD::move(__q.c)), comp(_STD::move(__q.comp)) @@ -483,7 +510,7 @@ priority_queue<_Tp, _Container, _Compare>::operator=(priority_queue&& __q) template template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a, typename enable_if::value>::type*) @@ -493,7 +520,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a, template template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, const _Alloc& __a, typename enable_if::priority_queue(const value_compare& _ template template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, const container_type& __c, const _Alloc& __a, @@ -519,7 +546,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _ template template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q, const _Alloc& __a, typename enable_if::priority_queue(const priority_queue& template template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, container_type&& __c, const _Alloc& __a, @@ -548,7 +575,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _ template template -inline +inline _LIBCPP_INLINE_VISIBILITY priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, const _Alloc& __a, typename enable_if::priority_queue(priority_queue&& __q, #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template -inline +inline _LIBCPP_INLINE_VISIBILITY void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) { @@ -573,7 +600,7 @@ priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template -inline +inline _LIBCPP_INLINE_VISIBILITY void priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) { @@ -585,7 +612,7 @@ priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) template template -inline +inline _LIBCPP_INLINE_VISIBILITY void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) { @@ -597,7 +624,7 @@ priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template -inline +inline _LIBCPP_INLINE_VISIBILITY void priority_queue<_Tp, _Container, _Compare>::pop() { @@ -606,7 +633,7 @@ priority_queue<_Tp, _Container, _Compare>::pop() } template -inline +inline _LIBCPP_INLINE_VISIBILITY void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q) { @@ -616,7 +643,7 @@ priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q) } template -inline +inline _LIBCPP_INLINE_VISIBILITY void swap(priority_queue<_Tp, _Container, _Compare>& __x, priority_queue<_Tp, _Container, _Compare>& __y) @@ -625,7 +652,7 @@ swap(priority_queue<_Tp, _Container, _Compare>& __x, } template -struct uses_allocator, _Alloc> +struct _LIBCPP_VISIBLE uses_allocator, _Alloc> : public uses_allocator<_Container, _Alloc> { }; diff --git a/include/random b/include/random index 5de738ad..5a74f639 100644 --- a/include/random +++ b/include/random @@ -1663,6 +1663,7 @@ template { typedef unsigned long long result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { // Schrage's algorithm @@ -1680,6 +1681,7 @@ template struct __lce_ta<__a, 0, __m, (unsigned long long)(~0), true> { typedef unsigned long long result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { // Schrage's algorithm @@ -1696,6 +1698,7 @@ template { typedef unsigned long long result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { return (__a * __x + __c) % __m; @@ -1706,6 +1709,7 @@ template struct __lce_ta<__a, __c, 0, (unsigned long long)(~0), false> { typedef unsigned long long result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { return __a * __x + __c; @@ -1718,6 +1722,7 @@ template struct __lce_ta<_A, _C, _M, unsigned(~0), true> { typedef unsigned result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { const result_type __a = static_cast(_A); @@ -1738,6 +1743,7 @@ template struct __lce_ta<_A, 0, _M, unsigned(~0), true> { typedef unsigned result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { const result_type __a = static_cast(_A); @@ -1756,6 +1762,7 @@ template struct __lce_ta<_A, _C, _M, unsigned(~0), false> { typedef unsigned result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { const result_type __a = static_cast(_A); @@ -1769,6 +1776,7 @@ template struct __lce_ta<_A, _C, 0, unsigned(~0), false> { typedef unsigned result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { const result_type __a = static_cast(_A); @@ -1783,6 +1791,7 @@ template { typedef unsigned short result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { return static_cast(__lce_ta<__a, __c, __m, unsigned(~0)>::next(__x)); @@ -1805,7 +1814,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_U, _A, _C, _N>& __x); template -class linear_congruential_engine +class _LIBCPP_VISIBLE linear_congruential_engine { public: // types @@ -1827,20 +1836,26 @@ public: static const/*expr*/ result_type multiplier = __a; static const/*expr*/ result_type increment = __c; static const/*expr*/ result_type modulus = __m; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() {return _Min;} + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() {return _Max;} static const/*expr*/ result_type default_seed = 1u; // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY explicit linear_congruential_engine(result_type __s = default_seed) {seed(__s);} template explicit linear_congruential_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if::value>::type* = 0) {seed(__q);} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __s = default_seed) {seed(integral_constant(), integral_constant(), __s);} template + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -1852,23 +1867,31 @@ public: : (__m-1) / 0x100000000ull)>());} // generating functions + _LIBCPP_INLINE_VISIBILITY result_type operator()() {return __x_ = static_cast(__lce_ta<__a, __c, __m, _M>::next(__x_));} + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} - friend bool operator==(const linear_congruential_engine& __x, - const linear_congruential_engine& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const linear_congruential_engine& __x, + const linear_congruential_engine& __y) {return __x.__x_ == __y.__x_;} - friend bool operator!=(const linear_congruential_engine& __x, - const linear_congruential_engine& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const linear_congruential_engine& __x, + const linear_congruential_engine& __y) {return !(__x == __y);} private: + _LIBCPP_INLINE_VISIBILITY void seed(true_type, true_type, result_type __s) {__x_ = __s == 0 ? 1 : __s;} + _LIBCPP_INLINE_VISIBILITY void seed(true_type, false_type, result_type __s) {__x_ = __s;} + _LIBCPP_INLINE_VISIBILITY void seed(false_type, true_type, result_type __s) {__x_ = __s % __m == 0 ? 1 : __s % __m;} + _LIBCPP_INLINE_VISIBILITY void seed(false_type, false_type, result_type __s) {__x_ = __s % __m;} template @@ -1931,11 +1954,13 @@ class __save_flags __save_flags(const __save_flags&); __save_flags& operator=(const __save_flags&); public: + _LIBCPP_INLINE_VISIBILITY explicit __save_flags(__stream_type& __stream) : __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {} + _LIBCPP_INLINE_VISIBILITY ~__save_flags() { __stream_.flags(__fmtflags_); @@ -1945,7 +1970,7 @@ public: template -inline +inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_UIntType, __a, __c, __m>& __x) @@ -2022,7 +2047,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, template -class mersenne_twister_engine +class _LIBCPP_VISIBLE mersenne_twister_engine { public: // types @@ -2067,18 +2092,23 @@ public: static const/*expr*/ result_type tempering_c = __c; static const/*expr*/ size_t tempering_l = __l; static const/*expr*/ result_type initialization_multiplier = __f; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min; } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max; } static const/*expr*/ result_type default_seed = 5489u; // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY explicit mersenne_twister_engine(result_type __sd = default_seed) {seed(__sd);} template explicit mersenne_twister_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if::value>::type* = 0) {seed(__q);} void seed(result_type __sd = default_seed); template + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -2089,6 +2119,7 @@ public: // generating functions result_type operator()(); + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} template ); template + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2147,6 +2179,7 @@ private: __lshift(result_type __x) {return (__x << __count) & _Max;} template + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2156,6 +2189,7 @@ private: __lshift(result_type __x) {return result_type(0);} template + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2165,6 +2199,7 @@ private: __rshift(result_type __x) {return __x >> __count;} template + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2305,7 +2340,7 @@ operator==(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, _B, _T, _C, _L, _F>& __x, @@ -2400,7 +2435,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UI, _W, _S, _R>& __x); template -class subtract_with_carry_engine +class _LIBCPP_VISIBLE subtract_with_carry_engine { public: // types @@ -2426,19 +2461,25 @@ public: static const/*expr*/ size_t word_size = __w; static const/*expr*/ size_t short_lag = __s; static const/*expr*/ size_t long_lag = __r; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min; } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max; } static const/*expr*/ result_type default_seed = 19780503u; // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY explicit subtract_with_carry_engine(result_type __sd = default_seed) {seed(__sd);} template explicit subtract_with_carry_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if::value>::type* = 0) {seed(__q);} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __sd = default_seed) {seed(__sd, integral_constant());} template + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -2449,6 +2490,7 @@ public: // generating functions result_type operator()(); + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} template @@ -2604,7 +2646,7 @@ operator==( } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=( const subtract_with_carry_engine<_UI, _W, _S, _R>& __x, @@ -2659,7 +2701,7 @@ typedef subtract_with_carry_engine ranlux48_base; // discard_block_engine template -class discard_block_engine +class _LIBCPP_VISIBLE discard_block_engine { _Engine __e_; int __n_; @@ -2678,25 +2720,36 @@ public: static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Engine::min(); } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Engine::max(); } // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY discard_block_engine() : __n_(0) {} + _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(const _Engine& __e) : __e_(__e), __n_(0) {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(_Engine&& __e) : __e_(_STD::move(__e)), __n_(0) {} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {} - template explicit discard_block_engine(_Sseq& __q, + template + _LIBCPP_INLINE_VISIBILITY + explicit discard_block_engine(_Sseq& __q, typename enable_if::value && !is_convertible<_Sseq, _Engine>::value>::type* = 0) : __e_(__q), __n_(0) {} + _LIBCPP_INLINE_VISIBILITY void seed() {__e_.seed(); __n_ = 0;} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __sd) {__e_.seed(__sd); __n_ = 0;} template + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -2706,9 +2759,11 @@ public: // generating functions result_type operator()(); + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} // property functions + _LIBCPP_INLINE_VISIBILITY const _Engine& base() const {return __e_;} template @@ -2754,7 +2809,7 @@ discard_block_engine<_Engine, __p, __r>::operator()() } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator==(const discard_block_engine<_Eng, _P, _R>& __x, const discard_block_engine<_Eng, _P, _R>& __y) @@ -2763,7 +2818,7 @@ operator==(const discard_block_engine<_Eng, _P, _R>& __x, } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const discard_block_engine<_Eng, _P, _R>& __x, const discard_block_engine<_Eng, _P, _R>& __y) @@ -2809,7 +2864,7 @@ typedef discard_block_engine ranlux48; // independent_bits_engine template -class independent_bits_engine +class _LIBCPP_VISIBLE independent_bits_engine { template class __get_n @@ -2865,25 +2920,35 @@ public: static_assert(_Min < _Max, "independent_bits_engine invalid parameters"); // engine characteristics + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min; } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max; } // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY independent_bits_engine() {} + _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(const _Engine& __e) : __e_(__e) {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(_Engine&& __e) : __e_(_STD::move(__e)) {} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} template explicit independent_bits_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if::value && !is_convertible<_Sseq, _Engine>::value>::type* = 0) : __e_(__q) {} + _LIBCPP_INLINE_VISIBILITY void seed() {__e_.seed();} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __sd) {__e_.seed(__sd);} template + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -2892,10 +2957,13 @@ public: seed(_Sseq& __q) {__e_.seed(__q);} // generating functions + _LIBCPP_INLINE_VISIBILITY result_type operator()() {return __eval(integral_constant());} + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} // property functions + _LIBCPP_INLINE_VISIBILITY const _Engine& base() const {return __e_;} template @@ -2931,6 +2999,7 @@ private: result_type __eval(true_type); template + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2940,6 +3009,7 @@ private: __lshift(result_type __x) {return __x << __count;} template + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2950,7 +3020,7 @@ private: }; template -inline +inline _LIBCPP_INLINE_VISIBILITY _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type) { @@ -2984,7 +3054,7 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator==( const independent_bits_engine<_Eng, _W, _UI>& __x, @@ -2994,7 +3064,7 @@ operator==( } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=( const independent_bits_engine<_Eng, _W, _UI>& __x, @@ -3052,7 +3122,7 @@ public: }; template -class shuffle_order_engine +class _LIBCPP_VISIBLE shuffle_order_engine { static_assert(0 < __k, "shuffle_order_engine invalid parameters"); public: @@ -3071,27 +3141,37 @@ public: static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; static_assert(_Min < _Max, "shuffle_order_engine invalid parameters"); + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min; } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max; } static const unsigned long long _R = _Max - _Min + 1ull; // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY shuffle_order_engine() {__init();} + _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(const _Engine& __e) : __e_(__e) {__init();} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(_Engine&& __e) : __e_(_STD::move(__e)) {__init();} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();} template explicit shuffle_order_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if::value && !is_convertible<_Sseq, _Engine>::value>::type* = 0) : __e_(__q) {__init();} + _LIBCPP_INLINE_VISIBILITY void seed() {__e_.seed(); __init();} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __sd) {__e_.seed(__sd); __init();} template + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -3100,10 +3180,13 @@ public: seed(_Sseq& __q) {__e_.seed(__q); __init();} // generating functions + _LIBCPP_INLINE_VISIBILITY result_type operator()() {return __eval(integral_constant());} + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} // property functions + _LIBCPP_INLINE_VISIBILITY const _Engine& base() const {return __e_;} private: @@ -3135,6 +3218,7 @@ private: operator>>(basic_istream<_CharT, _Traits>& __is, shuffle_order_engine<_Eng, _K>& __x); + _LIBCPP_INLINE_VISIBILITY void __init() { for (size_t __i = 0; __i < __k; ++__i) @@ -3142,13 +3226,18 @@ private: _Y_ = __e_(); } + _LIBCPP_INLINE_VISIBILITY result_type __eval(false_type) {return __eval2(integral_constant());} + _LIBCPP_INLINE_VISIBILITY result_type __eval(true_type) {return __eval(__uratio<__k, _R>());} + _LIBCPP_INLINE_VISIBILITY result_type __eval2(false_type) {return __eval(__uratio<__k/2, 0x8000000000000000ull>());} + _LIBCPP_INLINE_VISIBILITY result_type __eval2(true_type) {return __evalf<__k, 0>();} template + _LIBCPP_INLINE_VISIBILITY typename enable_if < (__uratio<_N, _D>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), @@ -3158,6 +3247,7 @@ private: {return __evalf<__uratio<_N, _D>::num, __uratio<_N, _D>::den>();} template + _LIBCPP_INLINE_VISIBILITY typename enable_if < __uratio<_N, _D>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), @@ -3173,6 +3263,7 @@ private: } template + _LIBCPP_INLINE_VISIBILITY result_type __evalf() { const double _F = __d == 0 ? @@ -3196,7 +3287,7 @@ operator==( } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=( const shuffle_order_engine<_Eng, _K>& __x, @@ -3249,7 +3340,7 @@ typedef shuffle_order_engine knuth_b; // random_device -class random_device +class _LIBCPP_VISIBLE random_device { int __f_; public: @@ -3260,7 +3351,9 @@ public: static const result_type _Min = 0; static const result_type _Max = 0xFFFFFFFFu; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min;} + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max;} // constructors @@ -3281,7 +3374,7 @@ private: // seed_seq -class seed_seq +class _LIBCPP_VISIBLE seed_seq { public: // types @@ -3294,11 +3387,14 @@ private: void init(_InputIterator __first, _InputIterator __last); public: // constructors + _LIBCPP_INLINE_VISIBILITY seed_seq() {} template + _LIBCPP_INLINE_VISIBILITY seed_seq(initializer_list<_Tp> __il) {init(__il.begin(), __il.end());} template + _LIBCPP_INLINE_VISIBILITY seed_seq(_InputIterator __first, _InputIterator __last) {init(__first, __last);} @@ -3307,8 +3403,10 @@ public: void generate(_RandomAccessIterator __first, _RandomAccessIterator __last); // property functions + _LIBCPP_INLINE_VISIBILITY size_t size() const {return __v_.size();} template + _LIBCPP_INLINE_VISIBILITY void param(_OutputIterator __dest) const {_STD::copy(__v_.begin(), __v_.end(), __dest);} @@ -3317,6 +3415,7 @@ private: seed_seq(const seed_seq&); // = delete; void operator=(const seed_seq&); // = delete; + _LIBCPP_INLINE_VISIBILITY static result_type _T(result_type __x) {return __x ^ (__x >> 27);} }; @@ -3446,29 +3545,34 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // uniform_real_distribution template -class uniform_real_distribution +class _LIBCPP_VISIBLE uniform_real_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __a_; result_type __b_; public: typedef uniform_real_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __a_;} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __b_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -3477,37 +3581,50 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit uniform_real_distribution(result_type __a = 0, result_type __b = 1) : __p_(param_type(__a, __b)) {} + _LIBCPP_INLINE_VISIBILITY explicit uniform_real_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __p_.a();} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __p_.b();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return a();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return b();} - friend bool operator==(const uniform_real_distribution& __x, - const uniform_real_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const uniform_real_distribution& __x, + const uniform_real_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const uniform_real_distribution& __x, - const uniform_real_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const uniform_real_distribution& __x, + const uniform_real_distribution& __y) {return !(__x == __y);} }; template template -inline +inline _LIBCPP_INLINE_VISIBILITY typename uniform_real_distribution<_RealType>::result_type uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { @@ -3549,25 +3666,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // bernoulli_distribution -class bernoulli_distribution +class _LIBCPP_VISIBLE bernoulli_distribution { public: // types typedef bool result_type; - class param_type + class _LIBCPP_VISIBLE param_type { double __p_; public: typedef bernoulli_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(double __p = 0.5) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -3576,35 +3697,47 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit bernoulli_distribution(double __p = 0.5) : __p_(param_type(__p)) {} + _LIBCPP_INLINE_VISIBILITY explicit bernoulli_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_.p();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return false;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return true;} - friend bool operator==(const bernoulli_distribution& __x, - const bernoulli_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const bernoulli_distribution& __x, + const bernoulli_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const bernoulli_distribution& __x, - const bernoulli_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const bernoulli_distribution& __x, + const bernoulli_distribution& __y) {return !(__x == __y);} }; template -inline +inline _LIBCPP_INLINE_VISIBILITY bernoulli_distribution::result_type bernoulli_distribution::operator()(_URNG& __g, const param_type& __p) { @@ -3642,13 +3775,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x) // binomial_distribution template -class binomial_distribution +class _LIBCPP_VISIBLE binomial_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __t_; double __p_; @@ -3660,12 +3793,16 @@ public: explicit param_type(result_type __t = 1, double __p = 0.5); + _LIBCPP_INLINE_VISIBILITY result_type t() const {return __t_;} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} friend class binomial_distribution; @@ -3676,31 +3813,44 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit binomial_distribution(result_type __t = 1, double __p = 0.5) : __p_(param_type(__t, __p)) {} + _LIBCPP_INLINE_VISIBILITY explicit binomial_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type t() const {return __p_.t();} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_.p();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return t();} - friend bool operator==(const binomial_distribution& __x, - const binomial_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const binomial_distribution& __x, + const binomial_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const binomial_distribution& __x, - const binomial_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const binomial_distribution& __x, + const binomial_distribution& __y) {return !(__x == __y);} }; @@ -3790,25 +3940,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // exponential_distribution template -class exponential_distribution +class _LIBCPP_VISIBLE exponential_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __lambda_; public: typedef exponential_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {} + _LIBCPP_INLINE_VISIBILITY result_type lambda() const {return __lambda_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__lambda_ == __y.__lambda_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -3817,30 +3971,42 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit exponential_distribution(result_type __lambda = 1) : __p_(param_type(__lambda)) {} + _LIBCPP_INLINE_VISIBILITY explicit exponential_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type lambda() const {return __p_.lambda();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const exponential_distribution& __x, - const exponential_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const exponential_distribution& __x, + const exponential_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const exponential_distribution& __x, - const exponential_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const exponential_distribution& __x, + const exponential_distribution& __y) {return !(__x == __y);} }; @@ -3889,28 +4055,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // normal_distribution template -class normal_distribution +class _LIBCPP_VISIBLE normal_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __mean_; result_type __stddev_; public: typedef normal_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __mean = 0, result_type __stddev = 1) : __mean_(__mean), __stddev_(__stddev) {} + _LIBCPP_INLINE_VISIBILITY result_type mean() const {return __mean_;} + _LIBCPP_INLINE_VISIBILITY result_type stddev() const {return __stddev_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -3921,33 +4092,46 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit normal_distribution(result_type __mean = 0, result_type __stddev = 1) : __p_(param_type(__mean, __stddev)), _V_hot_(false) {} + _LIBCPP_INLINE_VISIBILITY explicit normal_distribution(const param_type& __p) : __p_(__p), _V_hot_(false) {} + _LIBCPP_INLINE_VISIBILITY void reset() {_V_hot_ = false;} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type mean() const {return __p_.mean();} + _LIBCPP_INLINE_VISIBILITY result_type stddev() const {return __p_.stddev();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return -numeric_limits::infinity();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const normal_distribution& __x, - const normal_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const normal_distribution& __x, + const normal_distribution& __y) {return __x.__p_ == __y.__p_ && __x._V_hot_ == __y._V_hot_ && (!__x._V_hot_ || __x._V_ == __y._V_);} - friend bool operator!=(const normal_distribution& __x, - const normal_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const normal_distribution& __x, + const normal_distribution& __y) {return !(__x == __y);} template @@ -4039,27 +4223,32 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // lognormal_distribution template -class lognormal_distribution +class _LIBCPP_VISIBLE lognormal_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { normal_distribution __nd_; public: typedef lognormal_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __m = 0, result_type __s = 1) : __nd_(__m, __s) {} + _LIBCPP_INLINE_VISIBILITY result_type m() const {return __nd_.mean();} + _LIBCPP_INLINE_VISIBILITY result_type s() const {return __nd_.stddev();} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__nd_ == __y.__nd_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} friend class lognormal_distribution; @@ -4081,33 +4270,48 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit lognormal_distribution(result_type __m = 0, result_type __s = 1) : __p_(param_type(__m, __s)) {} + _LIBCPP_INLINE_VISIBILITY explicit lognormal_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {__p_.__nd_.reset();} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} - template result_type operator()(_URNG& __g, const param_type& __p) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g, const param_type& __p) {return _STD::exp(const_cast&>(__p.__nd_)(__g));} // property functions + _LIBCPP_INLINE_VISIBILITY result_type m() const {return __p_.m();} + _LIBCPP_INLINE_VISIBILITY result_type s() const {return __p_.s();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const lognormal_distribution& __x, - const lognormal_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const lognormal_distribution& __x, + const lognormal_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const lognormal_distribution& __x, - const lognormal_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const lognormal_distribution& __x, + const lognormal_distribution& __y) {return !(__x == __y);} template @@ -4124,7 +4328,7 @@ public: }; template -inline +inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const lognormal_distribution<_RT>& __x) @@ -4133,7 +4337,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template -inline +inline _LIBCPP_INLINE_VISIBILITY basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, lognormal_distribution<_RT>& __x) @@ -4144,13 +4348,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // poisson_distribution template -class poisson_distribution +class _LIBCPP_VISIBLE poisson_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { double __mean_; double __s_; @@ -4168,11 +4372,14 @@ public: explicit param_type(double __mean = 1.0); + _LIBCPP_INLINE_VISIBILITY double mean() const {return __mean_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__mean_ == __y.__mean_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} friend class poisson_distribution; @@ -4183,29 +4390,41 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit poisson_distribution(double __mean = 1.0) : __p_(__mean) {} + _LIBCPP_INLINE_VISIBILITY explicit poisson_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY double mean() const {return __p_.mean();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::max();} - friend bool operator==(const poisson_distribution& __x, - const poisson_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const poisson_distribution& __x, + const poisson_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const poisson_distribution& __x, - const poisson_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const poisson_distribution& __x, + const poisson_distribution& __y) {return !(__x == __y);} }; @@ -4360,28 +4579,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // weibull_distribution template -class weibull_distribution +class _LIBCPP_VISIBLE weibull_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __a_; result_type __b_; public: typedef weibull_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __a = 1, result_type __b = 1) : __a_(__a), __b_(__b) {} + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __a_;} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __b_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4390,34 +4614,49 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit weibull_distribution(result_type __a = 1, result_type __b = 1) : __p_(param_type(__a, __b)) {} + _LIBCPP_INLINE_VISIBILITY explicit weibull_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} - template result_type operator()(_URNG& __g, const param_type& __p) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g, const param_type& __p) {return __p.b() * _STD::pow(exponential_distribution()(__g), 1/__p.a());} // property functions + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __p_.a();} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __p_.b();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const weibull_distribution& __x, - const weibull_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const weibull_distribution& __x, + const weibull_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const weibull_distribution& __x, - const weibull_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const weibull_distribution& __x, + const weibull_distribution& __y) {return !(__x == __y);} }; @@ -4454,28 +4693,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, } template -class extreme_value_distribution +class _LIBCPP_VISIBLE extreme_value_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __a_; result_type __b_; public: typedef extreme_value_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __a_;} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __b_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4484,32 +4728,45 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit extreme_value_distribution(result_type __a = 0, result_type __b = 1) : __p_(param_type(__a, __b)) {} + _LIBCPP_INLINE_VISIBILITY explicit extreme_value_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __p_.a();} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __p_.b();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return -numeric_limits::infinity();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const extreme_value_distribution& __x, - const extreme_value_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const extreme_value_distribution& __x, + const extreme_value_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const extreme_value_distribution& __x, - const extreme_value_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const extreme_value_distribution& __x, + const extreme_value_distribution& __y) {return !(__x == __y);} }; @@ -4557,28 +4814,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // gamma_distribution template -class gamma_distribution +class _LIBCPP_VISIBLE gamma_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __alpha_; result_type __beta_; public: typedef gamma_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __alpha = 1, result_type __beta = 1) : __alpha_(__alpha), __beta_(__beta) {} + _LIBCPP_INLINE_VISIBILITY result_type alpha() const {return __alpha_;} + _LIBCPP_INLINE_VISIBILITY result_type beta() const {return __beta_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4587,32 +4849,45 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit gamma_distribution(result_type __alpha = 1, result_type __beta = 1) : __p_(param_type(__alpha, __beta)) {} + _LIBCPP_INLINE_VISIBILITY explicit gamma_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type alpha() const {return __p_.alpha();} + _LIBCPP_INLINE_VISIBILITY result_type beta() const {return __p_.beta();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const gamma_distribution& __x, - const gamma_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const gamma_distribution& __x, + const gamma_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const gamma_distribution& __x, - const gamma_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const gamma_distribution& __x, + const gamma_distribution& __y) {return !(__x == __y);} }; @@ -4711,28 +4986,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // negative_binomial_distribution template -class negative_binomial_distribution +class _LIBCPP_VISIBLE negative_binomial_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __k_; double __p_; public: typedef negative_binomial_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __k = 1, double __p = 0.5) : __k_(__k), __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY result_type k() const {return __k_;} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4741,31 +5021,44 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit negative_binomial_distribution(result_type __k = 1, double __p = 0.5) : __p_(__k, __p) {} + _LIBCPP_INLINE_VISIBILITY explicit negative_binomial_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type k() const {return __p_.k();} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_.p();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::max();} - friend bool operator==(const negative_binomial_distribution& __x, - const negative_binomial_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const negative_binomial_distribution& __x, + const negative_binomial_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const negative_binomial_distribution& __x, - const negative_binomial_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const negative_binomial_distribution& __x, + const negative_binomial_distribution& __y) {return !(__x == __y);} }; @@ -4828,25 +5121,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // geometric_distribution template -class geometric_distribution +class _LIBCPP_VISIBLE geometric_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { double __p_; public: typedef geometric_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(double __p = 0.5) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4855,30 +5152,44 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit geometric_distribution(double __p = 0.5) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY explicit geometric_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} - template result_type operator()(_URNG& __g, const param_type& __p) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g, const param_type& __p) {return negative_binomial_distribution(1, __p.p())(__g);} // property functions + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_.p();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::max();} - friend bool operator==(const geometric_distribution& __x, - const geometric_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const geometric_distribution& __x, + const geometric_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const geometric_distribution& __x, - const geometric_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const geometric_distribution& __x, + const geometric_distribution& __y) {return !(__x == __y);} }; @@ -4912,25 +5223,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // chi_squared_distribution template -class chi_squared_distribution +class _LIBCPP_VISIBLE chi_squared_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __n_; public: typedef chi_squared_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __n = 1) : __n_(__n) {} + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __n_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__n_ == __y.__n_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4939,32 +5254,46 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit chi_squared_distribution(result_type __n = 1) : __p_(param_type(__n)) {} + _LIBCPP_INLINE_VISIBILITY explicit chi_squared_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} - template result_type operator()(_URNG& __g, const param_type& __p) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g, const param_type& __p) {return gamma_distribution(__p.n() / 2, 2)(__g);} // property functions + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __p_.n();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const chi_squared_distribution& __x, - const chi_squared_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const chi_squared_distribution& __x, + const chi_squared_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const chi_squared_distribution& __x, - const chi_squared_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const chi_squared_distribution& __x, + const chi_squared_distribution& __y) {return !(__x == __y);} }; @@ -5000,28 +5329,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // cauchy_distribution template -class cauchy_distribution +class _LIBCPP_VISIBLE cauchy_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __a_; result_type __b_; public: typedef cauchy_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __a_;} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __b_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -5030,38 +5364,51 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit cauchy_distribution(result_type __a = 0, result_type __b = 1) : __p_(param_type(__a, __b)) {} + _LIBCPP_INLINE_VISIBILITY explicit cauchy_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __p_.a();} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __p_.b();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return -numeric_limits::infinity();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const cauchy_distribution& __x, - const cauchy_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const cauchy_distribution& __x, + const cauchy_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const cauchy_distribution& __x, - const cauchy_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const cauchy_distribution& __x, + const cauchy_distribution& __y) {return !(__x == __y);} }; template template -inline +inline _LIBCPP_INLINE_VISIBILITY _RealType cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { @@ -5105,28 +5452,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // fisher_f_distribution template -class fisher_f_distribution +class _LIBCPP_VISIBLE fisher_f_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __m_; result_type __n_; public: typedef fisher_f_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __m = 1, result_type __n = 1) : __m_(__m), __n_(__n) {} + _LIBCPP_INLINE_VISIBILITY result_type m() const {return __m_;} + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __n_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -5135,32 +5487,45 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit fisher_f_distribution(result_type __m = 1, result_type __n = 1) : __p_(param_type(__m, __n)) {} + _LIBCPP_INLINE_VISIBILITY explicit fisher_f_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type m() const {return __p_.m();} + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __p_.n();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const fisher_f_distribution& __x, - const fisher_f_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const fisher_f_distribution& __x, + const fisher_f_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const fisher_f_distribution& __x, - const fisher_f_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const fisher_f_distribution& __x, + const fisher_f_distribution& __y) {return !(__x == __y);} }; @@ -5209,25 +5574,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // student_t_distribution template -class student_t_distribution +class _LIBCPP_VISIBLE student_t_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __n_; public: typedef student_t_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __n = 1) : __n_(__n) {} + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __n_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__n_ == __y.__n_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -5237,31 +5606,43 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit student_t_distribution(result_type __n = 1) : __p_(param_type(__n)) {} + _LIBCPP_INLINE_VISIBILITY explicit student_t_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {__nd_.reset();} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __p_.n();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return -numeric_limits::infinity();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits::infinity();} - friend bool operator==(const student_t_distribution& __x, - const student_t_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const student_t_distribution& __x, + const student_t_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const student_t_distribution& __x, - const student_t_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const student_t_distribution& __x, + const student_t_distribution& __y) {return !(__x == __y);} }; @@ -5306,22 +5687,25 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // discrete_distribution template -class discrete_distribution +class _LIBCPP_VISIBLE discrete_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { vector __p_; public: typedef discrete_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY param_type() {} template + _LIBCPP_INLINE_VISIBILITY param_type(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {__init();} + _LIBCPP_INLINE_VISIBILITY param_type(initializer_list __wl) : __p_(__wl.begin(), __wl.end()) {__init();} template @@ -5330,9 +5714,11 @@ public: vector probabilities() const; - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} private: @@ -5358,39 +5744,54 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY discrete_distribution() {} template + _LIBCPP_INLINE_VISIBILITY discrete_distribution(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {} + _LIBCPP_INLINE_VISIBILITY discrete_distribution(initializer_list __wl) : __p_(__wl) {} template + _LIBCPP_INLINE_VISIBILITY discrete_distribution(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw) : __p_(__nw, __xmin, __xmax, __fw) {} explicit discrete_distribution(const param_type& __p) + _LIBCPP_INLINE_VISIBILITY : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY vector probabilities() const {return __p_.probabilities();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return __p_.__p_.size();} - friend bool operator==(const discrete_distribution& __x, - const discrete_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const discrete_distribution& __x, + const discrete_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const discrete_distribution& __x, - const discrete_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const discrete_distribution& __x, + const discrete_distribution& __y) {return !(__x == __y);} template @@ -5513,13 +5914,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // piecewise_constant_distribution template -class piecewise_constant_distribution +class _LIBCPP_VISIBLE piecewise_constant_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { typedef typename common_type::type __area_type; vector __b_; @@ -5538,12 +5939,16 @@ public: param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); + _LIBCPP_INLINE_VISIBILITY vector intervals() const {return __b_;} + _LIBCPP_INLINE_VISIBILITY vector densities() const {return __densities_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} private: @@ -5569,47 +5974,63 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution() {} template + _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} template + _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution(initializer_list __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} template + _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw) : __p_(__nw, __xmin, __xmax, __fw) {} + _LIBCPP_INLINE_VISIBILITY explicit piecewise_constant_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY vector intervals() const {return __p_.intervals();} + _LIBCPP_INLINE_VISIBILITY vector densities() const {return __p_.densities();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return __p_.__b_.front();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return __p_.__b_.back();} - friend bool operator==(const piecewise_constant_distribution& __x, - const piecewise_constant_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const piecewise_constant_distribution& __x, + const piecewise_constant_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const piecewise_constant_distribution& __x, + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const piecewise_constant_distribution& __x, const piecewise_constant_distribution& __y) {return !(__x == __y);} @@ -5794,13 +6215,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // piecewise_linear_distribution template -class piecewise_linear_distribution +class _LIBCPP_VISIBLE piecewise_linear_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { typedef typename common_type::type __area_type; vector __b_; @@ -5819,12 +6240,16 @@ public: param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); + _LIBCPP_INLINE_VISIBILITY vector intervals() const {return __b_;} + _LIBCPP_INLINE_VISIBILITY vector densities() const {return __densities_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} private: @@ -5850,48 +6275,64 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution() {} template + _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} template + _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution(initializer_list __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} template + _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw) : __p_(__nw, __xmin, __xmax, __fw) {} + _LIBCPP_INLINE_VISIBILITY explicit piecewise_linear_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template result_type operator()(_URNG& __g) + template + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY vector intervals() const {return __p_.intervals();} + _LIBCPP_INLINE_VISIBILITY vector densities() const {return __p_.densities();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return __p_.__b_.front();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return __p_.__b_.back();} - friend bool operator==(const piecewise_linear_distribution& __x, - const piecewise_linear_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const piecewise_linear_distribution& __x, + const piecewise_linear_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const piecewise_linear_distribution& __x, - const piecewise_linear_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const piecewise_linear_distribution& __x, + const piecewise_linear_distribution& __y) {return !(__x == __y);} template