diff --git a/include/forward_list b/include/forward_list index b23981ec..5e5d5361 100644 --- a/include/forward_list +++ b/include/forward_list @@ -174,7 +174,7 @@ struct __forward_begin_node pointer __next_; - __forward_begin_node() : __next_(nullptr) {} + _LIBCPP_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {} }; template @@ -198,12 +198,13 @@ template class forward_list; template class __forward_list_const_iterator; template -class __forward_list_iterator +class _LIBCPP_VISIBLE __forward_list_iterator { typedef _NodePtr __node_pointer; __node_pointer __ptr_; + _LIBCPP_INLINE_VISIBILITY explicit __forward_list_iterator(__node_pointer __p) : __ptr_(__p) {} template friend class forward_list; @@ -224,16 +225,21 @@ public: #endif pointer; + _LIBCPP_INLINE_VISIBILITY __forward_list_iterator() : __ptr_(nullptr) {} + _LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;} + _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;} + _LIBCPP_INLINE_VISIBILITY __forward_list_iterator& operator++() { __ptr_ = __ptr_->__next_; return *this; } + _LIBCPP_INLINE_VISIBILITY __forward_list_iterator operator++(int) { __forward_list_iterator __t(*this); @@ -241,21 +247,24 @@ public: return __t; } - friend bool operator==(const __forward_list_iterator& __x, - const __forward_list_iterator& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const __forward_list_iterator& __x, + const __forward_list_iterator& __y) {return __x.__ptr_ == __y.__ptr_;} - friend bool operator!=(const __forward_list_iterator& __x, - const __forward_list_iterator& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const __forward_list_iterator& __x, + const __forward_list_iterator& __y) {return !(__x == __y);} }; template -class __forward_list_const_iterator +class _LIBCPP_VISIBLE __forward_list_const_iterator { typedef _NodeConstPtr __node_const_pointer; __node_const_pointer __ptr_; + _LIBCPP_INLINE_VISIBILITY explicit __forward_list_const_iterator(__node_const_pointer __p) : __ptr_(__p) {} @@ -287,18 +296,24 @@ public: #endif pointer; + _LIBCPP_INLINE_VISIBILITY __forward_list_const_iterator() : __ptr_(nullptr) {} + _LIBCPP_INLINE_VISIBILITY __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) : __ptr_(__p.__ptr_) {} + _LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;} + _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;} + _LIBCPP_INLINE_VISIBILITY __forward_list_const_iterator& operator++() { __ptr_ = __ptr_->__next_; return *this; } + _LIBCPP_INLINE_VISIBILITY __forward_list_const_iterator operator++(int) { __forward_list_const_iterator __t(*this); @@ -306,10 +321,12 @@ public: return __t; } - friend bool operator==(const __forward_list_const_iterator& __x, - const __forward_list_const_iterator& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const __forward_list_const_iterator& __x, + const __forward_list_const_iterator& __y) {return __x.__ptr_ == __y.__ptr_;} - friend bool operator!=(const __forward_list_const_iterator& __x, + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const __forward_list_const_iterator& __x, const __forward_list_const_iterator& __y) {return !(__x == __y);} }; @@ -337,21 +354,27 @@ protected: __compressed_pair<__begin_node, __node_allocator> __before_begin_; + _LIBCPP_INLINE_VISIBILITY __node_pointer __before_begin() {return pointer_traits<__node_pointer>::pointer_to( static_cast<__node&>(__before_begin_.first()));} + _LIBCPP_INLINE_VISIBILITY __node_const_pointer __before_begin() const {return pointer_traits<__node_const_pointer>::pointer_to( static_cast(__before_begin_.first()));} + _LIBCPP_INLINE_VISIBILITY __node_allocator& __alloc() {return __before_begin_.second();} + _LIBCPP_INLINE_VISIBILITY const __node_allocator& __alloc() const {return __before_begin_.second();} typedef __forward_list_iterator<__node_pointer> iterator; typedef __forward_list_const_iterator<__node_const_pointer> const_iterator; + _LIBCPP_INLINE_VISIBILITY __forward_list_base() : __before_begin_(__begin_node()) {} + _LIBCPP_INLINE_VISIBILITY __forward_list_base(const allocator_type& __a) : __before_begin_(__begin_node(), __node_allocator(__a)) {} @@ -367,10 +390,12 @@ protected: ~__forward_list_base(); + _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const __forward_list_base& __x) {__copy_assign_alloc(__x, integral_constant());} + _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__forward_list_base& __x) {__move_assign_alloc(__x, integral_constant());} @@ -379,7 +404,9 @@ protected: void clear(); private: + _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const __forward_list_base&, false_type) {} + _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const __forward_list_base& __x, true_type) { if (__alloc() != __x.__alloc()) @@ -387,16 +414,21 @@ private: __alloc() = __x.__alloc(); } + _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__forward_list_base& __x, false_type) {} + _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__forward_list_base& __x, true_type) {__alloc() = _STD::move(__x.__alloc());} + _LIBCPP_INLINE_VISIBILITY static void __swap_alloc(__node_allocator& __x, __node_allocator& __y) {__swap_alloc(__x, __y, integral_constant());} + _LIBCPP_INLINE_VISIBILITY static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type) {} + _LIBCPP_INLINE_VISIBILITY static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type) { @@ -408,7 +440,7 @@ private: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template -inline +inline _LIBCPP_INLINE_VISIBILITY __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) : __before_begin_(_STD::move(__x.__before_begin_)) { @@ -416,7 +448,7 @@ __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) } template -inline +inline _LIBCPP_INLINE_VISIBILITY __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, const allocator_type& __a) : __before_begin_(__begin_node(), __node_allocator(__a)) @@ -437,7 +469,7 @@ __forward_list_base<_Tp, _Alloc>::~__forward_list_base() } template -inline +inline _LIBCPP_INLINE_VISIBILITY void __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x) { @@ -462,7 +494,7 @@ __forward_list_base<_Tp, _Alloc>::clear() } template > -class forward_list +class _LIBCPP_VISIBLE forward_list : private __forward_list_base<_Tp, _Alloc> { typedef __forward_list_base<_Tp, _Alloc> base; @@ -480,7 +512,7 @@ public: typedef typename base::iterator iterator; typedef typename base::const_iterator const_iterator; - forward_list() {} // = default; + _LIBCPP_INLINE_VISIBILITY forward_list() {} // = default; explicit forward_list(const allocator_type& __a); explicit forward_list(size_type __n); forward_list(size_type __n, const value_type& __v); @@ -499,6 +531,7 @@ public: forward_list(const forward_list& __x); forward_list(const forward_list& __x, const allocator_type& __a); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY forward_list(forward_list&& __x) : base(_STD::move(__x)) {} forward_list(forward_list&& __x, const allocator_type& __a); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -523,24 +556,38 @@ public: void assign(size_type __n, const value_type& __v); void assign(initializer_list __il); + _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return allocator_type(base::__alloc());} + _LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(base::__before_begin()->__next_);} + _LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(base::__before_begin()->__next_);} + _LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(nullptr);} + _LIBCPP_INLINE_VISIBILITY const_iterator end() const {return const_iterator(nullptr);} + _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const {return const_iterator(base::__before_begin()->__next_);} + _LIBCPP_INLINE_VISIBILITY const_iterator cend() const {return const_iterator(nullptr);} + _LIBCPP_INLINE_VISIBILITY iterator before_begin() {return iterator(base::__before_begin());} + _LIBCPP_INLINE_VISIBILITY const_iterator before_begin() const {return const_iterator(base::__before_begin());} + _LIBCPP_INLINE_VISIBILITY const_iterator cbefore_begin() const {return const_iterator(base::__before_begin());} + _LIBCPP_INLINE_VISIBILITY bool empty() const {return base::__before_begin()->__next_ == nullptr;} + _LIBCPP_INLINE_VISIBILITY size_type max_size() const {return numeric_limits::max();} + _LIBCPP_INLINE_VISIBILITY reference front() {return base::__before_begin()->__next_->__value_;} + _LIBCPP_INLINE_VISIBILITY const_reference front() const {return base::__before_begin()->__next_->__value_;} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -563,6 +610,7 @@ public: iterator insert_after(const_iterator __p, const value_type& __v); iterator insert_after(const_iterator __p, size_type __n, const value_type& __v); template + _LIBCPP_INLINE_VISIBILITY typename enable_if < __is_input_iterator<_InputIterator>::value, @@ -575,10 +623,12 @@ public: iterator erase_after(const_iterator __p); iterator erase_after(const_iterator __f, const_iterator __l); + _LIBCPP_INLINE_VISIBILITY void swap(forward_list& __x) {base::swap(__x);} void resize(size_type __n); void resize(size_type __n, const value_type& __v); + _LIBCPP_INLINE_VISIBILITY void clear() {base::clear();} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -594,15 +644,19 @@ public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES void remove(const value_type& __v); template void remove_if(_Predicate __pred); + _LIBCPP_INLINE_VISIBILITY void unique() {unique(__equal_to());} template void unique(_BinaryPredicate __binary_pred); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY void merge(forward_list&& __x) {merge(_STD::move(__x), __less());} template void merge(forward_list&& __x, _Compare __comp); #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY void merge(forward_list& __x) {merge(__x, __less());} template void merge(forward_list& __x, _Compare __comp); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY void sort() {sort(__less());} template void sort(_Compare __comp); void reverse(); @@ -630,7 +684,7 @@ private: }; template -inline +inline _LIBCPP_INLINE_VISIBILITY forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a) : base(__a) { @@ -777,7 +831,7 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type) } template -inline +inline _LIBCPP_INLINE_VISIBILITY forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) { @@ -789,7 +843,7 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template -inline +inline _LIBCPP_INLINE_VISIBILITY forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(initializer_list __il) { @@ -833,7 +887,7 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) } template -inline +inline _LIBCPP_INLINE_VISIBILITY void forward_list<_Tp, _Alloc>::assign(initializer_list __il) { @@ -1344,7 +1398,7 @@ forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2, template template -inline +inline _LIBCPP_INLINE_VISIBILITY void forward_list<_Tp, _Alloc>::sort(_Compare __comp) { @@ -1419,7 +1473,7 @@ bool operator==(const forward_list<_Tp, _Alloc>& __x, } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { @@ -1427,7 +1481,7 @@ bool operator!=(const forward_list<_Tp, _Alloc>& __x, } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator< (const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { @@ -1436,7 +1490,7 @@ bool operator< (const forward_list<_Tp, _Alloc>& __x, } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator> (const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { @@ -1444,7 +1498,7 @@ bool operator> (const forward_list<_Tp, _Alloc>& __x, } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator>=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { @@ -1452,7 +1506,7 @@ bool operator>=(const forward_list<_Tp, _Alloc>& __x, } template -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator<=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { @@ -1460,7 +1514,7 @@ bool operator<=(const forward_list<_Tp, _Alloc>& __x, } template -inline +inline _LIBCPP_INLINE_VISIBILITY void swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y) { diff --git a/include/fstream b/include/fstream index e0259b91..e0c7dea2 100644 --- a/include/fstream +++ b/include/fstream @@ -176,7 +176,7 @@ typedef basic_fstream wfstream; _LIBCPP_BEGIN_NAMESPACE_STD template -class basic_filebuf +class _LIBCPP_VISIBLE basic_filebuf : public basic_streambuf<_CharT, _Traits> { public: @@ -957,7 +957,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode() // basic_ifstream template -class basic_ifstream +class _LIBCPP_VISIBLE basic_ifstream : public basic_istream<_CharT, _Traits> { public: @@ -1102,7 +1102,7 @@ basic_ifstream<_CharT, _Traits>::close() // basic_ofstream template -class basic_ofstream +class _LIBCPP_VISIBLE basic_ofstream : public basic_ostream<_CharT, _Traits> { public: @@ -1247,7 +1247,7 @@ basic_ofstream<_CharT, _Traits>::close() // basic_fstream template -class basic_fstream +class _LIBCPP_VISIBLE basic_fstream : public basic_iostream<_CharT, _Traits> { public: diff --git a/include/functional b/include/functional index 3cc21d48..3205ee36 100644 --- a/include/functional +++ b/include/functional @@ -478,133 +478,133 @@ POLICY: For non-variadic implementations, the number of arguments is limited _LIBCPP_BEGIN_NAMESPACE_STD template -struct plus : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_VISIBLE plus : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x + __y;} }; template -struct minus : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_VISIBLE minus : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x - __y;} }; template -struct multiplies : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_VISIBLE multiplies : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x * __y;} }; template -struct divides : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_VISIBLE divides : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x / __y;} }; template -struct modulus : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_VISIBLE modulus : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x % __y;} }; template -struct negate : unary_function<_Tp, _Tp> +struct _LIBCPP_VISIBLE negate : unary_function<_Tp, _Tp> { _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const {return -__x;} }; template -struct equal_to : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_VISIBLE equal_to : binary_function<_Tp, _Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const {return __x == __y;} }; template -struct not_equal_to : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_VISIBLE not_equal_to : binary_function<_Tp, _Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const {return __x != __y;} }; template -struct greater : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_VISIBLE greater : binary_function<_Tp, _Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const {return __x > __y;} }; template -struct less : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_VISIBLE less : binary_function<_Tp, _Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const {return __x < __y;} }; template -struct greater_equal : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_VISIBLE greater_equal : binary_function<_Tp, _Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const {return __x >= __y;} }; template -struct less_equal : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_VISIBLE less_equal : binary_function<_Tp, _Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const {return __x <= __y;} }; template -struct logical_and : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_VISIBLE logical_and : binary_function<_Tp, _Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const {return __x && __y;} }; template -struct logical_or : binary_function<_Tp, _Tp, bool> +struct _LIBCPP_VISIBLE logical_or : binary_function<_Tp, _Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const {return __x || __y;} }; template -struct logical_not : unary_function<_Tp, bool> +struct _LIBCPP_VISIBLE logical_not : unary_function<_Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x) const {return !__x;} }; template -struct bit_and : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_VISIBLE bit_and : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x & __y;} }; template -struct bit_or : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_VISIBLE bit_or : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x | __y;} }; template -struct bit_xor : binary_function<_Tp, _Tp, _Tp> +struct _LIBCPP_VISIBLE bit_xor : binary_function<_Tp, _Tp, _Tp> { _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x ^ __y;} }; template -class unary_negate +class _LIBCPP_VISIBLE unary_negate : public unary_function { _Predicate __pred_; @@ -621,7 +621,7 @@ unary_negate<_Predicate> not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);} template -class binary_negate +class _LIBCPP_VISIBLE binary_negate : public binary_function @@ -641,7 +641,7 @@ binary_negate<_Predicate> not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);} template -class binder1st +class _LIBCPP_VISIBLE binder1st : public unary_function { @@ -667,7 +667,7 @@ bind1st(const __Operation& __op, const _Tp& __x) {return binder1st<__Operation>(__op, __x);} template -class binder2nd +class _LIBCPP_VISIBLE binder2nd : public unary_function { @@ -675,6 +675,7 @@ protected: __Operation op; typename __Operation::second_argument_type value; public: + _LIBCPP_INLINE_VISIBILITY binder2nd(const __Operation& __x, const typename __Operation::second_argument_type __y) : op(__x), value(__y) {} _LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator() @@ -692,7 +693,8 @@ bind2nd(const __Operation& __op, const _Tp& __x) {return binder2nd<__Operation>(__op, __x);} template -class pointer_to_unary_function : public unary_function<_Arg, _Result> +class _LIBCPP_VISIBLE pointer_to_unary_function + : public unary_function<_Arg, _Result> { _Result (*__f_)(_Arg); public: @@ -709,7 +711,8 @@ ptr_fun(_Result (*__f)(_Arg)) {return pointer_to_unary_function<_Arg,_Result>(__f);} template -class pointer_to_binary_function : public binary_function<_Arg1, _Arg2, _Result> +class _LIBCPP_VISIBLE pointer_to_binary_function + : public binary_function<_Arg1, _Arg2, _Result> { _Result (*__f_)(_Arg1, _Arg2); public: @@ -726,7 +729,7 @@ ptr_fun(_Result (*__f)(_Arg1,_Arg2)) {return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);} template -class mem_fun_t : public unary_function<_Tp*, _Sp> +class _LIBCPP_VISIBLE mem_fun_t : public unary_function<_Tp*, _Sp> { _Sp (_Tp::*__p_)(); public: @@ -737,7 +740,7 @@ public: }; template -class mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp> +class _LIBCPP_VISIBLE mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap); public: @@ -760,7 +763,7 @@ mem_fun(_Sp (_Tp::*__f)(_Ap)) {return mem_fun1_t<_Sp,_Tp,_Ap>(__f);} template -class mem_fun_ref_t : public unary_function<_Tp, _Sp> +class _LIBCPP_VISIBLE mem_fun_ref_t : public unary_function<_Tp, _Sp> { _Sp (_Tp::*__p_)(); public: @@ -771,7 +774,7 @@ public: }; template -class mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp> +class _LIBCPP_VISIBLE mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap); public: @@ -794,7 +797,7 @@ mem_fun_ref(_Sp (_Tp::*__f)(_Ap)) {return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);} template -class const_mem_fun_t : public unary_function +class _LIBCPP_VISIBLE const_mem_fun_t : public unary_function { _Sp (_Tp::*__p_)() const; public: @@ -805,7 +808,7 @@ public: }; template -class const_mem_fun1_t : public binary_function +class _LIBCPP_VISIBLE const_mem_fun1_t : public binary_function { _Sp (_Tp::*__p_)(_Ap) const; public: @@ -828,7 +831,7 @@ mem_fun(_Sp (_Tp::*__f)(_Ap) const) {return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);} template -class const_mem_fun_ref_t : public unary_function<_Tp, _Sp> +class _LIBCPP_VISIBLE const_mem_fun_ref_t : public unary_function<_Tp, _Sp> { _Sp (_Tp::*__p_)() const; public: @@ -839,7 +842,8 @@ public: }; template -class const_mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp> +class _LIBCPP_VISIBLE const_mem_fun1_ref_t + : public binary_function<_Tp, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap) const; public: @@ -882,6 +886,7 @@ public: // invoke template + _LIBCPP_INLINE_VISIBILITY typename __invoke_return::type operator() (_ArgTypes&&... __args) { @@ -931,12 +936,12 @@ mem_fn(_R (_T::* __pm)(_Args...) const volatile) // bad_function_call -class bad_function_call +class _LIBCPP_EXCEPTION_ABI bad_function_call : public exception { }; -template class function; // undefined +template class _LIBCPP_VISIBLE function; // undefined namespace __function { @@ -971,8 +976,8 @@ class __base<_R(_ArgTypes...)> __base(const __base&); __base& operator=(const __base&); public: - __base() {} - virtual ~__base() {} + _LIBCPP_INLINE_VISIBILITY __base() {} + _LIBCPP_INLINE_VISIBILITY virtual ~__base() {} virtual __base* __clone() const = 0; virtual void __clone(__base*) const = 0; virtual void destroy() = 0; @@ -992,7 +997,9 @@ class __func<_F, _Alloc, _R(_ArgTypes...)> { __compressed_pair<_F, _Alloc> __f_; public: + _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {} + _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {} virtual __base<_R(_ArgTypes...)>* __clone() const; virtual void __clone(__base<_R(_ArgTypes...)>*) const; @@ -1071,7 +1078,7 @@ __func<_F, _Alloc, _R(_ArgTypes...)>::target_type() const } // __function template -class function<_R(_ArgTypes...)> +class _LIBCPP_VISIBLE function<_R(_ArgTypes...)> : public __function::__maybe_derive_from_unary_function<_R(_ArgTypes...)>, public __function::__maybe_derive_from_binary_function<_R(_ArgTypes...)> { @@ -1080,24 +1087,33 @@ class function<_R(_ArgTypes...)> __base* __f_; template + _LIBCPP_INLINE_VISIBILITY static bool __not_null(const _F&) {return true;} template + _LIBCPP_INLINE_VISIBILITY static bool __not_null(_R2 (*__p)(_A...)) {return __p;} template + _LIBCPP_INLINE_VISIBILITY static bool __not_null(_R2 (_C::*__p)(_A...)) {return __p;} template + _LIBCPP_INLINE_VISIBILITY static bool __not_null(_R2 (_C::*__p)(_A...) const) {return __p;} template + _LIBCPP_INLINE_VISIBILITY static bool __not_null(_R2 (_C::*__p)(_A...) volatile) {return __p;} template + _LIBCPP_INLINE_VISIBILITY static bool __not_null(_R2 (_C::*__p)(_A...) const volatile) {return __p;} template + _LIBCPP_INLINE_VISIBILITY static bool __not_null(const function<_R(_A...)>& __p) {return __p;} public: typedef _R result_type; // construct/copy/destroy: + _LIBCPP_INLINE_VISIBILITY function() : __f_(0) {} + _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {} function(const function&); function(function&&); @@ -1106,8 +1122,10 @@ public: typename enable_if::value>::type* = 0); template + _LIBCPP_INLINE_VISIBILITY function(allocator_arg_t, const _Alloc&) : __f_(0) {} template + _LIBCPP_INLINE_VISIBILITY function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {} template function(allocator_arg_t, const _Alloc&, const function&); @@ -1133,10 +1151,12 @@ public: // function modifiers: void swap(function&); template + _LIBCPP_INLINE_VISIBILITY void assign(_F&& __f, const _Alloc& __a) {function(allocator_arg, __a, _STD::forward<_F>(__f)).swap(*this);} // function capacity: + _LIBCPP_INLINE_VISIBILITY /*explicit*/ operator bool() const {return __f_;} // deleted overloads close possible hole in the type system @@ -1453,11 +1473,11 @@ swap(function<_R(_ArgTypes...)>& __x, function<_R(_ArgTypes...)>& __y) {return __x.swap(__y);} template struct __is_bind_expression : public false_type {}; -template struct is_bind_expression +template struct _LIBCPP_VISIBLE is_bind_expression : public __is_bind_expression::type> {}; template struct __is_placeholder : public integral_constant {}; -template struct is_placeholder +template struct _LIBCPP_VISIBLE is_placeholder : public __is_placeholder::type> {}; namespace placeholders @@ -1645,16 +1665,19 @@ class __bind typedef typename __make_tuple_indices::type __indices; public: + _LIBCPP_INLINE_VISIBILITY __bind(__bind&& __b) : __f_(_STD::move(__b.__f_)), __bound_args_(_STD::move(__b.__bound_args_)) {} template + _LIBCPP_INLINE_VISIBILITY explicit __bind(_G&& __f, _BA&& ...__bound_args) : __f_(_STD::forward<_G>(__f)), __bound_args_(_STD::forward<_BA>(__bound_args)...) {} template + _LIBCPP_INLINE_VISIBILITY typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type operator()(_Args&& ...__args) { @@ -1664,6 +1687,7 @@ public: } template + _LIBCPP_INLINE_VISIBILITY typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type operator()(_Args&& ...__args) const { @@ -1684,11 +1708,13 @@ public: typedef _R result_type; template + _LIBCPP_INLINE_VISIBILITY explicit __bind_r(_G&& __f, _BA&& ...__bound_args) : base(_STD::forward<_G>(__f), _STD::forward<_BA>(__bound_args)...) {} template + _LIBCPP_INLINE_VISIBILITY result_type operator()(_Args&& ...__args) { @@ -1696,6 +1722,7 @@ public: } template + _LIBCPP_INLINE_VISIBILITY result_type operator()(_Args&& ...__args) const { @@ -1727,104 +1754,118 @@ bind(_F&& __f, _BoundArgs&&... __bound_args) #endif // _LIBCPP_HAS_NO_VARIADICS template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(bool __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(char __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(signed char __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned char __v) const {return static_cast(__v);} }; #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(char16_t __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(char32_t __v) const {return static_cast(__v);} }; #endif // _LIBCPP_HAS_NO_UNICODE_CHARS template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(wchar_t __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(short __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned short __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(int __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned int __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(long __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned long __v) const {return static_cast(__v);} }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(long long __v) const { size_t __r = 0; @@ -1836,9 +1877,10 @@ struct hash }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned long long __v) const { size_t __r = 0; @@ -1850,9 +1892,10 @@ struct hash }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(float __v) const { if (__v == 0) @@ -1863,9 +1906,10 @@ struct hash }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(double __v) const { if (__v == 0) @@ -1879,9 +1923,10 @@ struct hash }; template <> -struct hash +struct _LIBCPP_VISIBLE hash : public unary_function { + _LIBCPP_INLINE_VISIBILITY size_t operator()(long double __v) const { if (__v == 0)