forked from OSchip/llvm-project
parent
521c72c756
commit
0af133f941
|
@ -174,7 +174,7 @@ struct __forward_begin_node
|
|||
|
||||
pointer __next_;
|
||||
|
||||
__forward_begin_node() : __next_(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {}
|
||||
};
|
||||
|
||||
template <class _Tp, class _VoidPtr>
|
||||
|
@ -198,12 +198,13 @@ template<class, class> class forward_list;
|
|||
template<class> class __forward_list_const_iterator;
|
||||
|
||||
template <class _NodePtr>
|
||||
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<class, class> 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 _NodeConstPtr>
|
||||
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<const __node&>(__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<bool,
|
||||
__node_traits::propagate_on_container_copy_assignment::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__forward_list_base& __x)
|
||||
{__move_assign_alloc(__x, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_move_assignment::value>());}
|
||||
|
@ -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<bool,
|
||||
__node_traits::propagate_on_container_swap::value>());}
|
||||
_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 <class _Tp, class _Alloc>
|
||||
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 <class _Tp, class _Alloc>
|
||||
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 <class _Tp, class _Alloc>
|
||||
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 _Tp, class _Alloc = allocator<_Tp> >
|
||||
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<value_type> __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<size_type>::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 <class _InputIterator>
|
||||
_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 <class _Predicate> void remove_if(_Predicate __pred);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void unique() {unique(__equal_to<value_type>());}
|
||||
template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list&& __x) {merge(_STD::move(__x), __less<value_type>());}
|
||||
template <class _Compare> void merge(forward_list&& __x, _Compare __comp);
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list& __x) {merge(__x, __less<value_type>());}
|
||||
template <class _Compare> void merge(forward_list& __x, _Compare __comp);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void sort() {sort(__less<value_type>());}
|
||||
template <class _Compare> void sort(_Compare __comp);
|
||||
void reverse();
|
||||
|
@ -630,7 +684,7 @@ private:
|
|||
};
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
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 <class _Tp, class _Alloc>
|
||||
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 <class _Tp, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
forward_list<_Tp, _Alloc>&
|
||||
forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
|
||||
{
|
||||
|
@ -833,7 +887,7 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
|
|||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
|
||||
{
|
||||
|
@ -1344,7 +1398,7 @@ forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2,
|
|||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class _Compare>
|
||||
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 <class _Tp, class _Alloc>
|
||||
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 <class _Tp, class _Alloc>
|
||||
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 <class _Tp, class _Alloc>
|
||||
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 <class _Tp, class _Alloc>
|
||||
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 <class _Tp, class _Alloc>
|
||||
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 <class _Tp, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
|
||||
{
|
||||
|
|
|
@ -176,7 +176,7 @@ typedef basic_fstream<wchar_t> wfstream;
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
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 _CharT, class _Traits>
|
||||
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 _CharT, class _Traits>
|
||||
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 _CharT, class _Traits>
|
||||
class basic_fstream
|
||||
class _LIBCPP_VISIBLE basic_fstream
|
||||
: public basic_iostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -478,133 +478,133 @@ POLICY: For non-variadic implementations, the number of arguments is limited
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 <class _Tp>
|
||||
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 _Predicate>
|
||||
class unary_negate
|
||||
class _LIBCPP_VISIBLE unary_negate
|
||||
: public unary_function<typename _Predicate::argument_type, bool>
|
||||
{
|
||||
_Predicate __pred_;
|
||||
|
@ -621,7 +621,7 @@ unary_negate<_Predicate>
|
|||
not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);}
|
||||
|
||||
template <class _Predicate>
|
||||
class binary_negate
|
||||
class _LIBCPP_VISIBLE binary_negate
|
||||
: public binary_function<typename _Predicate::first_argument_type,
|
||||
typename _Predicate::second_argument_type,
|
||||
bool>
|
||||
|
@ -641,7 +641,7 @@ binary_negate<_Predicate>
|
|||
not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
|
||||
|
||||
template <class __Operation>
|
||||
class binder1st
|
||||
class _LIBCPP_VISIBLE binder1st
|
||||
: public unary_function<typename __Operation::second_argument_type,
|
||||
typename __Operation::result_type>
|
||||
{
|
||||
|
@ -667,7 +667,7 @@ bind1st(const __Operation& __op, const _Tp& __x)
|
|||
{return binder1st<__Operation>(__op, __x);}
|
||||
|
||||
template <class __Operation>
|
||||
class binder2nd
|
||||
class _LIBCPP_VISIBLE binder2nd
|
||||
: public unary_function<typename __Operation::first_argument_type,
|
||||
typename __Operation::result_type>
|
||||
{
|
||||
|
@ -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 _Arg, class _Result>
|
||||
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 _Arg1, class _Arg2, class _Result>
|
||||
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 _Sp, class _Tp>
|
||||
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 _Sp, class _Tp, class _Ap>
|
||||
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 _Sp, class _Tp>
|
||||
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 _Sp, class _Tp, class _Ap>
|
||||
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 _Sp, class _Tp>
|
||||
class const_mem_fun_t : public unary_function<const _Tp*, _Sp>
|
||||
class _LIBCPP_VISIBLE const_mem_fun_t : public unary_function<const _Tp*, _Sp>
|
||||
{
|
||||
_Sp (_Tp::*__p_)() const;
|
||||
public:
|
||||
|
@ -805,7 +808,7 @@ public:
|
|||
};
|
||||
|
||||
template <class _Sp, class _Tp, class _Ap>
|
||||
class const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp>
|
||||
class _LIBCPP_VISIBLE const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp>
|
||||
{
|
||||
_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 _Sp, class _Tp>
|
||||
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 _Sp, class _Tp, class _Ap>
|
||||
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 <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return<type, _ArgTypes...>::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 _Fp> class function; // undefined
|
||||
template<class _Fp> 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 _R, class ..._ArgTypes>
|
||||
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 <class _F>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(const _F&) {return true;}
|
||||
template <class _R2, class ..._A>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (*__p)(_A...)) {return __p;}
|
||||
template <class _R2, class _C, class ..._A>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_A...)) {return __p;}
|
||||
template <class _R2, class _C, class ..._A>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_A...) const) {return __p;}
|
||||
template <class _R2, class _C, class ..._A>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_A...) volatile) {return __p;}
|
||||
template <class _R2, class _C, class ..._A>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_A...) const volatile) {return __p;}
|
||||
template <class _R2, class ..._A>
|
||||
_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<!is_integral<_F>::value>::type* = 0);
|
||||
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
function(allocator_arg_t, const _Alloc&, const function&);
|
||||
|
@ -1133,10 +1151,12 @@ public:
|
|||
// function modifiers:
|
||||
void swap(function&);
|
||||
template<class _F, class _Alloc>
|
||||
_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<class _Tp> struct __is_bind_expression : public false_type {};
|
||||
template<class _Tp> struct is_bind_expression
|
||||
template<class _Tp> struct _LIBCPP_VISIBLE is_bind_expression
|
||||
: public __is_bind_expression<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
|
||||
template<class _Tp> struct is_placeholder
|
||||
template<class _Tp> struct _LIBCPP_VISIBLE is_placeholder
|
||||
: public __is_placeholder<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
namespace placeholders
|
||||
|
@ -1645,16 +1665,19 @@ class __bind
|
|||
|
||||
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bind(__bind&& __b)
|
||||
: __f_(_STD::move(__b.__f_)),
|
||||
__bound_args_(_STD::move(__b.__bound_args_)) {}
|
||||
|
||||
template <class _G, class ..._BA>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __bind(_G&& __f, _BA&& ...__bound_args)
|
||||
: __f_(_STD::forward<_G>(__f)),
|
||||
__bound_args_(_STD::forward<_BA>(__bound_args)...) {}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
|
@ -1664,6 +1687,7 @@ public:
|
|||
}
|
||||
|
||||
template <class ..._Args>
|
||||
_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 <class _G, class ..._BA>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __bind_r(_G&& __f, _BA&& ...__bound_args)
|
||||
: base(_STD::forward<_G>(__f),
|
||||
_STD::forward<_BA>(__bound_args)...) {}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result_type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
|
@ -1696,6 +1722,7 @@ public:
|
|||
}
|
||||
|
||||
template <class ..._Args>
|
||||
_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<bool>
|
||||
struct _LIBCPP_VISIBLE hash<bool>
|
||||
: public unary_function<bool, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(bool __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<char>
|
||||
struct _LIBCPP_VISIBLE hash<char>
|
||||
: public unary_function<char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<signed char>
|
||||
struct _LIBCPP_VISIBLE hash<signed char>
|
||||
: public unary_function<signed char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(signed char __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<unsigned char>
|
||||
struct _LIBCPP_VISIBLE hash<unsigned char>
|
||||
: public unary_function<unsigned char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned char __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
struct hash<char16_t>
|
||||
struct _LIBCPP_VISIBLE hash<char16_t>
|
||||
: public unary_function<char16_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char16_t __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<char32_t>
|
||||
struct _LIBCPP_VISIBLE hash<char32_t>
|
||||
: public unary_function<char32_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char32_t __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
struct hash<wchar_t>
|
||||
struct _LIBCPP_VISIBLE hash<wchar_t>
|
||||
: public unary_function<wchar_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(wchar_t __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<short>
|
||||
struct _LIBCPP_VISIBLE hash<short>
|
||||
: public unary_function<short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(short __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<unsigned short>
|
||||
struct _LIBCPP_VISIBLE hash<unsigned short>
|
||||
: public unary_function<unsigned short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned short __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<int>
|
||||
struct _LIBCPP_VISIBLE hash<int>
|
||||
: public unary_function<int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(int __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<unsigned int>
|
||||
struct _LIBCPP_VISIBLE hash<unsigned int>
|
||||
: public unary_function<unsigned int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned int __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<long>
|
||||
struct _LIBCPP_VISIBLE hash<long>
|
||||
: public unary_function<long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<unsigned long>
|
||||
struct _LIBCPP_VISIBLE hash<unsigned long>
|
||||
: public unary_function<unsigned long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned long __v) const {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<long long>
|
||||
struct _LIBCPP_VISIBLE hash<long long>
|
||||
: public unary_function<long long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long long __v) const
|
||||
{
|
||||
size_t __r = 0;
|
||||
|
@ -1836,9 +1877,10 @@ struct hash<long long>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct hash<unsigned long long>
|
||||
struct _LIBCPP_VISIBLE hash<unsigned long long>
|
||||
: public unary_function<unsigned long long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned long long __v) const
|
||||
{
|
||||
size_t __r = 0;
|
||||
|
@ -1850,9 +1892,10 @@ struct hash<unsigned long long>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct hash<float>
|
||||
struct _LIBCPP_VISIBLE hash<float>
|
||||
: public unary_function<float, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(float __v) const
|
||||
{
|
||||
if (__v == 0)
|
||||
|
@ -1863,9 +1906,10 @@ struct hash<float>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct hash<double>
|
||||
struct _LIBCPP_VISIBLE hash<double>
|
||||
: public unary_function<double, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(double __v) const
|
||||
{
|
||||
if (__v == 0)
|
||||
|
@ -1879,9 +1923,10 @@ struct hash<double>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct hash<long double>
|
||||
struct _LIBCPP_VISIBLE hash<long double>
|
||||
: public unary_function<long double, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long double __v) const
|
||||
{
|
||||
if (__v == 0)
|
||||
|
|
Loading…
Reference in New Issue