visibility-decoration.

llvm-svn: 114551
This commit is contained in:
Howard Hinnant 2010-09-22 16:48:34 +00:00
parent 754e1efffc
commit 848a5374d0
6 changed files with 523 additions and 179 deletions

View File

@ -325,11 +325,11 @@ template <class T, size_t N> T* end(T (&array)[N]);
_LIBCPP_BEGIN_NAMESPACE_STD
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
struct _LIBCPP_VISIBLE input_iterator_tag {};
struct _LIBCPP_VISIBLE output_iterator_tag {};
struct _LIBCPP_VISIBLE forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_VISIBLE bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_VISIBLE random_access_iterator_tag : public bidirectional_iterator_tag {};
template <class _Tp>
struct __has_iterator_category
@ -372,11 +372,11 @@ struct __iterator_traits<_Iter, true>
// the client expects instead of failing at compile time.
template <class _Iter>
struct iterator_traits
struct _LIBCPP_VISIBLE iterator_traits
: __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
template<class _Tp>
struct iterator_traits<_Tp*>
struct _LIBCPP_VISIBLE iterator_traits<_Tp*>
{
typedef ptrdiff_t difference_type;
typedef typename remove_const<_Tp>::type value_type;
@ -407,7 +407,7 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
template<class _Category, class _Tp, class _Distance = ptrdiff_t,
class _Pointer = _Tp*, class _Reference = _Tp&>
struct iterator
struct _LIBCPP_VISIBLE iterator
{
typedef _Tp value_type;
typedef _Distance difference_type;
@ -482,7 +482,7 @@ distance(_InputIter __first, _InputIter __last)
}
template <class _ForwardIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIter
next(_ForwardIter __x,
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
@ -493,7 +493,7 @@ next(_ForwardIter __x,
}
template <class _BidiretionalIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
_BidiretionalIter
prev(_BidiretionalIter __x,
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
@ -504,7 +504,7 @@ prev(_BidiretionalIter __x,
}
template <class _Iter>
class reverse_iterator
class _LIBCPP_VISIBLE reverse_iterator
: public iterator<typename iterator_traits<_Iter>::iterator_category,
typename iterator_traits<_Iter>::value_type,
typename iterator_traits<_Iter>::difference_type,
@ -611,7 +611,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
}
template <class _Container>
class back_insert_iterator
class _LIBCPP_VISIBLE back_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@ -644,7 +644,7 @@ back_inserter(_Container& __x)
}
template <class _Container>
class front_insert_iterator
class _LIBCPP_VISIBLE front_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@ -677,7 +677,7 @@ front_inserter(_Container& __x)
}
template <class _Container>
class insert_iterator
class _LIBCPP_VISIBLE insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@ -713,7 +713,7 @@ inserter(_Container& __x, typename _Container::iterator __i)
template <class _Tp, class _CharT = char,
class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
class istream_iterator
class _LIBCPP_VISIBLE istream_iterator
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
{
public:
@ -752,7 +752,7 @@ public:
};
template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
class ostream_iterator
class _LIBCPP_VISIBLE ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@ -781,7 +781,7 @@ public:
};
template<class _CharT, class _Traits>
class istreambuf_iterator
class _LIBCPP_VISIBLE istreambuf_iterator
: public iterator<input_iterator_tag, _CharT,
typename _Traits::off_type, _CharT*,
_CharT>
@ -806,6 +806,7 @@ private:
_LIBCPP_INLINE_VISIBILITY char_type operator*() const {return __keep_;}
};
_LIBCPP_INLINE_VISIBILITY
void __test_for_eof()
{
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
@ -820,7 +821,7 @@ public:
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
: __sbuf_(__p.__sbuf_) {}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{
@ -852,7 +853,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
{return !__a.equal(__b);}
template <class _CharT, class _Traits>
class ostreambuf_iterator
class _LIBCPP_VISIBLE ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@ -880,7 +881,7 @@ public:
};
template <class _Iter>
class move_iterator
class _LIBCPP_VISIBLE move_iterator
{
private:
_Iter __i;
@ -1618,7 +1619,7 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
begin(_C& __c) -> decltype(__c.begin())
{
@ -1626,7 +1627,7 @@ begin(_C& __c) -> decltype(__c.begin())
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
begin(const _C& __c) -> decltype(__c.begin())
{
@ -1634,7 +1635,7 @@ begin(const _C& __c) -> decltype(__c.begin())
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
end(_C& __c) -> decltype(__c.end())
{
@ -1642,7 +1643,7 @@ end(_C& __c) -> decltype(__c.end())
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
end(const _C& __c) -> decltype(__c.end())
{
@ -1652,7 +1653,7 @@ end(const _C& __c) -> decltype(__c.end())
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator
begin(_C& __c)
{
@ -1660,7 +1661,7 @@ begin(_C& __c)
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator
begin(const _C& __c)
{
@ -1668,7 +1669,7 @@ begin(const _C& __c)
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator
end(_C& __c)
{
@ -1676,7 +1677,7 @@ end(_C& __c)
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator
end(const _C& __c)
{
@ -1686,7 +1687,7 @@ end(const _C& __c)
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
template <class _T, size_t _N>
inline
inline _LIBCPP_INLINE_VISIBILITY
_T*
begin(_T (&__array)[_N])
{
@ -1694,7 +1695,7 @@ begin(_T (&__array)[_N])
}
template <class _T, size_t _N>
inline
inline _LIBCPP_INLINE_VISIBILITY
_T*
end(_T (&__array)[_N])
{

View File

@ -425,7 +425,7 @@ protected:
};
template <class _Tp>
class numeric_limits
class _LIBCPP_VISIBLE numeric_limits
: private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
{
typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
@ -471,7 +471,7 @@ public:
};
template <class _Tp>
class numeric_limits<const _Tp>
class _LIBCPP_VISIBLE numeric_limits<const _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
@ -517,7 +517,7 @@ public:
};
template <class _Tp>
class numeric_limits<volatile _Tp>
class _LIBCPP_VISIBLE numeric_limits<volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
@ -563,7 +563,7 @@ public:
};
template <class _Tp>
class numeric_limits<const volatile _Tp>
class _LIBCPP_VISIBLE numeric_limits<const volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;

View File

@ -187,6 +187,7 @@ struct __list_node_base
pointer __prev_;
pointer __next_;
_LIBCPP_INLINE_VISIBILITY
__list_node_base()
: __prev_(static_cast<pointer>(this)),
__next_(static_cast<pointer>(this))
@ -205,7 +206,7 @@ template <class, class> class __list_imp;
template <class, class> class __list_const_iterator;
template <class _Tp, class _VoidPtr>
class __list_iterator
class _LIBCPP_VISIBLE __list_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@ -216,6 +217,7 @@ class __list_iterator
__node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __list_iterator(__node_pointer __p) : __ptr_(__p) {}
template<class, class> friend class list;
@ -234,23 +236,31 @@ public:
pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY
__list_iterator& operator++() {__ptr_ = __ptr_->__next_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__list_iterator& operator--() {__ptr_ = __ptr_->__prev_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;}
friend bool operator==(const __list_iterator& __x, const __list_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __list_iterator& __x, const __list_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
{return !(__x == __y);}
};
template <class _Tp, class _VoidPtr>
class __list_const_iterator
class _LIBCPP_VISIBLE __list_const_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@ -261,6 +271,7 @@ class __list_const_iterator
__node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __list_const_iterator(__node_pointer __p) : __ptr_(__p) {}
template<class, class> friend class list;
@ -278,20 +289,29 @@ public:
pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) : __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator& operator++() {__ptr_ = __ptr_->__next_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator& operator--() {__ptr_ = __ptr_->__prev_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;}
friend bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
{return !(__x == __y);}
};
@ -327,9 +347,13 @@ protected:
__node_base __end_;
__compressed_pair<size_type, __node_allocator> __size_alloc_;
_LIBCPP_INLINE_VISIBILITY
size_type& __sz() {return __size_alloc_.first();}
_LIBCPP_INLINE_VISIBILITY
const size_type& __sz() const {return __size_alloc_.first();}
_LIBCPP_INLINE_VISIBILITY
__node_allocator& __node_alloc() {return __size_alloc_.second();}
_LIBCPP_INLINE_VISIBILITY
const __node_allocator& __node_alloc() const {return __size_alloc_.second();}
static void __unlink_nodes(__node_base& __f, __node_base& __l);
@ -338,35 +362,46 @@ protected:
__list_imp(const allocator_type& __a);
~__list_imp();
void clear();
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __sz() == 0;}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return iterator(__end_.__next_);}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return const_iterator(__end_.__next_);}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return iterator(static_cast<__node_pointer> (&__end_));}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return const_iterator(static_cast<__node_const_pointer>(&__end_));}
void swap(__list_imp& __c);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __list_imp& __c)
{__copy_assign_alloc(__c, integral_constant<bool,
__node_alloc_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__list_imp& __c)
{__move_assign_alloc(__c, integral_constant<bool,
__node_alloc_traits::propagate_on_container_move_assignment::value>());}
private:
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__node_alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __list_imp& __c, true_type)
{
if (__node_alloc() != __c.__node_alloc())
@ -374,21 +409,24 @@ private:
__node_alloc() = __c.__node_alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __list_imp& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __list_imp& __c, true_type)
{
__node_alloc() = _STD::move(__c.__node_alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __list_imp& __c, false_type)
{}
};
// Unlink nodes [__f, __l]
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
{
@ -397,14 +435,14 @@ __list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__list_imp<_Tp, _Alloc>::__list_imp()
: __size_alloc_(0)
{
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a)
: __size_alloc_(0, __node_allocator(__a))
{
@ -459,7 +497,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
}
template <class _Tp, class _Alloc = allocator<_Tp> >
class list
class _LIBCPP_VISIBLE list
: private __list_imp<_Tp, _Alloc>
{
typedef __list_imp<_Tp, _Alloc> base;
@ -484,7 +522,9 @@ public:
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
list() {}
_LIBCPP_INLINE_VISIBILITY
list(const allocator_type& __a) : base(__a) {}
list(size_type __n);
list(size_type __n, const value_type& __x);
@ -506,6 +546,7 @@ public:
list(list&& __c, const allocator_type& __a);
list& operator=(list&& __c);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
list& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
@ -513,32 +554,52 @@ public:
void assign(_InpIter __f, _InpIter __l,
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
void assign(size_type __n, const value_type& __x);
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end());}
allocator_type get_allocator() const;
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return base::__sz();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return base::empty();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return numeric_limits<difference_type>::max();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return base::begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return base::end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return base::end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return base::end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
reference front() {return base::__end_.__next_->__value_;}
_LIBCPP_INLINE_VISIBILITY
const_reference front() const {return base::__end_.__next_->__value_;}
_LIBCPP_INLINE_VISIBILITY
reference back() {return base::__end_.__prev_->__value_;}
_LIBCPP_INLINE_VISIBILITY
const_reference back() const {return base::__end_.__prev_->__value_;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -563,10 +624,13 @@ public:
template <class _InpIter>
iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, initializer_list<value_type> __il)
{return insert(__p, __il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
void swap(list& __c) {base::swap(__c);}
_LIBCPP_INLINE_VISIBILITY
void clear() {base::clear();}
void pop_front();
@ -580,15 +644,18 @@ public:
void splice(const_iterator __p, list& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
#endif
void splice(const_iterator __p, list& __c, const_iterator __i);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice(const_iterator __p, list&& __c, const_iterator __i)
{splice(__p, __c, __i);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l)
{splice(__p, __c, __f, __l);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -600,12 +667,14 @@ public:
void unique(_BinaryPred __binary_pred);
void merge(list& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void merge(list&& __c) {merge(__c);}
#endif
template <class _Comp>
void merge(list& __c, _Comp __comp);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Comp>
_LIBCPP_INLINE_VISIBILITY
void merge(list&& __c, _Comp __comp) {merge(__c, __comp);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void sort();
@ -626,7 +695,7 @@ private:
// Link in nodes [__f, __l] just prior to __p
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::__link_nodes(__node& __p, __node& __f, __node& __l)
{
@ -637,7 +706,7 @@ list<_Tp, _Alloc>::__link_nodes(__node& __p, __node& __f, __node& __l)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::__iterator(size_type __n)
{
@ -726,7 +795,7 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
list<_Tp, _Alloc>&
list<_Tp, _Alloc>::operator=(const list& __c)
{
@ -741,7 +810,7 @@ list<_Tp, _Alloc>::operator=(const list& __c)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
list<_Tp, _Alloc>::list(list&& __c)
: base(allocator_type(_STD::move(__c.__node_alloc())))
{
@ -749,7 +818,7 @@ list<_Tp, _Alloc>::list(list&& __c)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
: base(__a)
{
@ -763,7 +832,7 @@ list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
list<_Tp, _Alloc>&
list<_Tp, _Alloc>::operator=(list&& __c)
{
@ -827,7 +896,7 @@ list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
_Alloc
list<_Tp, _Alloc>::get_allocator() const
{
@ -1316,7 +1385,7 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::unique()
{
@ -1339,7 +1408,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::merge(list& __c)
{
@ -1383,7 +1452,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::sort()
{
@ -1392,7 +1461,7 @@ list<_Tp, _Alloc>::sort()
template <class _Tp, class _Alloc>
template <class _Comp>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::sort(_Comp __comp)
{
@ -1401,7 +1470,6 @@ list<_Tp, _Alloc>::sort(_Comp __comp)
template <class _Tp, class _Alloc>
template <class _Comp>
inline
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp)
{
@ -1477,7 +1545,7 @@ list<_Tp, _Alloc>::reverse()
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@ -1485,7 +1553,7 @@ operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@ -1493,7 +1561,7 @@ operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@ -1501,7 +1569,7 @@ operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@ -1509,7 +1577,7 @@ operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@ -1517,7 +1585,7 @@ operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@ -1525,7 +1593,7 @@ operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
{

View File

@ -198,7 +198,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __APPLE__
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, _Tp __v)
@ -207,7 +207,7 @@ __nolocale_sprintf(char* __restrict __str,
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, _Tp __v)
@ -216,7 +216,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, int __prec, _Tp __v)
@ -225,7 +225,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
{
@ -233,7 +233,7 @@ __nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
_Tp __v)
@ -242,7 +242,7 @@ __nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, _Tp* __v)
@ -250,14 +250,14 @@ __nolocale_sscanf(const char* __restrict __str,
return sscanf_l(__str, 0, __format, __v);
}
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isxdigit(int __c)
{
return isxdigit_l(__c, 0);
}
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
{
@ -265,7 +265,8 @@ __nolocale_isdigit(int __c)
}
#else // __APPLE__
inline int
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, ...)
{
@ -275,7 +276,8 @@ __nolocale_sprintf(char* __restrict __str,
va_end(__ap);
return __result;
}
inline int
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, ...)
{
@ -285,7 +287,8 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
va_end(__ap);
return __result;
}
inline int
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret,
const char* __restrict __format, ...)
{
@ -295,7 +298,8 @@ __nolocale_asprintf(char** __ret,
va_end(__ap);
return __result;
}
inline int
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, ...)
{
@ -305,12 +309,15 @@ __nolocale_sscanf(const char* __restrict __str,
va_end(__ap);
return __result;
}
inline int
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isxdigit(int __c)
{
return isxdigit(__c);
}
inline int
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
{
return isdigit(__c);
@ -584,7 +591,7 @@ extern template class __num_get<char>;
extern template class __num_get<wchar_t>;
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class num_get
class _LIBCPP_VISIBLE num_get
: public locale::facet,
private __num_get<_CharT>
{
@ -676,6 +683,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~num_get() {}
virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
@ -1335,7 +1343,7 @@ extern template class __num_put<char>;
extern template class __num_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class num_put
class _LIBCPP_VISIBLE num_put
: public locale::facet,
private __num_put<_CharT>
{
@ -1406,6 +1414,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~num_put() {}
virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
@ -1740,7 +1749,7 @@ __get_up_to_n_digits(_InputIterator& __b, _InputIterator __e,
return __r;
}
class time_base
class _LIBCPP_VISIBLE time_base
{
public:
enum dateorder {no_order, dmy, mdy, ymd, ydm};
@ -1762,7 +1771,7 @@ protected:
};
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class time_get
class _LIBCPP_VISIBLE time_get
: public locale::facet,
public time_base,
private __time_get_c_storage<_CharT>
@ -1833,6 +1842,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~time_get() {}
virtual dateorder do_date_order() const;
@ -2406,7 +2416,7 @@ private:
};
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class time_get_byname
class _LIBCPP_VISIBLE time_get_byname
: public time_get<_CharT, _InputIterator>,
private __time_get_storage<_CharT>
{
@ -2416,24 +2426,35 @@ public:
typedef _CharT char_type;
typedef basic_string<char_type> string_type;
_LIBCPP_INLINE_VISIBILITY
explicit time_get_byname(const char* __nm, size_t __refs = 0)
: time_get<_CharT, _InputIterator>(__refs),
__time_get_storage<_CharT>(__nm) {}
_LIBCPP_INLINE_VISIBILITY
explicit time_get_byname(const string& __nm, size_t __refs = 0)
: time_get<_CharT, _InputIterator>(__refs),
__time_get_storage<_CharT>(__nm) {}
protected:
_LIBCPP_INLINE_VISIBILITY
~time_get_byname() {}
_LIBCPP_INLINE_VISIBILITY
virtual dateorder do_date_order() const {return this->__do_date_order();}
private:
_LIBCPP_INLINE_VISIBILITY
virtual const string_type* __weeks() const {return this->__weeks_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type* __months() const {return this->__months_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type* __am_pm() const {return this->__am_pm_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __c() const {return this->__c_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __r() const {return this->__r_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __x() const {return this->__x_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __X() const {return this->__X_;}
};
@ -2455,7 +2476,7 @@ protected:
};
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class time_put
class _LIBCPP_VISIBLE time_put
: public locale::facet,
private __time_put
{
@ -2480,13 +2501,16 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~time_put() {}
virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm,
char __fmt, char __mod) const;
_LIBCPP_ALWAYS_INLINE
explicit time_put(const char* __nm, size_t __refs)
: locale::facet(__refs),
__time_put(__nm) {}
_LIBCPP_ALWAYS_INLINE
explicit time_put(const string& __nm, size_t __refs)
: locale::facet(__refs),
__time_put(__nm) {}
@ -2551,7 +2575,7 @@ extern template class time_put<char>;
extern template class time_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class time_put_byname
class _LIBCPP_VISIBLE time_put_byname
: public time_put<_CharT, _OutputIterator>
{
public:
@ -2564,6 +2588,7 @@ public:
: time_put<_CharT, _OutputIterator>(__nm, __refs) {}
protected:
_LIBCPP_ALWAYS_INLINE
~time_put_byname() {}
};
@ -2572,7 +2597,7 @@ extern template class time_put_byname<wchar_t>;
// money_base
class money_base
class _LIBCPP_VISIBLE money_base
{
public:
enum part {none, space, symbol, sign, value};
@ -2584,7 +2609,7 @@ public:
// moneypunct
template <class _CharT, bool _International = false>
class moneypunct
class _LIBCPP_VISIBLE moneypunct
: public locale::facet,
public money_base
{
@ -2592,6 +2617,7 @@ public:
typedef _CharT char_type;
typedef basic_string<char_type> string_type;
_LIBCPP_ALWAYS_INLINE
explicit moneypunct(size_t __refs = 0)
: locale::facet(__refs) {}
@ -2609,17 +2635,27 @@ public:
static const bool intl = _International;
protected:
_LIBCPP_ALWAYS_INLINE
~moneypunct() {}
_LIBCPP_ALWAYS_INLINE
virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
_LIBCPP_ALWAYS_INLINE
virtual char_type do_thousands_sep() const {return numeric_limits<char_type>::max();}
_LIBCPP_ALWAYS_INLINE
virtual string do_grouping() const {return string();}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_curr_symbol() const {return string_type();}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_positive_sign() const {return string_type();}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_negative_sign() const {return string_type(1, '-');}
_LIBCPP_ALWAYS_INLINE
virtual int do_frac_digits() const {return 0;}
_LIBCPP_ALWAYS_INLINE
virtual pattern do_pos_format() const
{pattern __p = {symbol, sign, none, value}; return __p;}
_LIBCPP_ALWAYS_INLINE
virtual pattern do_neg_format() const
{pattern __p = {symbol, sign, none, value}; return __p;}
};
@ -2636,7 +2672,8 @@ extern template class moneypunct<wchar_t, true>;
// moneypunct_byname
template <class _CharT, bool _International = false>
class moneypunct_byname : public moneypunct<_CharT, _International>
class _LIBCPP_VISIBLE moneypunct_byname
: public moneypunct<_CharT, _International>
{
public:
typedef money_base::pattern pattern;
@ -2652,16 +2689,26 @@ public:
: moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());}
protected:
_LIBCPP_ALWAYS_INLINE
~moneypunct_byname() {}
_LIBCPP_ALWAYS_INLINE
virtual char_type do_decimal_point() const {return __decimal_point_;}
_LIBCPP_ALWAYS_INLINE
virtual char_type do_thousands_sep() const {return __thousands_sep_;}
_LIBCPP_ALWAYS_INLINE
virtual string do_grouping() const {return __grouping_;}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_curr_symbol() const {return __curr_symbol_;}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_positive_sign() const {return __positive_sign_;}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_negative_sign() const {return __negative_sign_;}
_LIBCPP_ALWAYS_INLINE
virtual int do_frac_digits() const {return __frac_digits_;}
_LIBCPP_ALWAYS_INLINE
virtual pattern do_pos_format() const {return __pos_format_;}
_LIBCPP_ALWAYS_INLINE
virtual pattern do_neg_format() const {return __neg_format_;}
private:
@ -2746,7 +2793,7 @@ extern template class __money_get<char>;
extern template class __money_get<wchar_t>;
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class money_get
class _LIBCPP_VISIBLE money_get
: public locale::facet,
private __money_get<_CharT>
{
@ -2777,6 +2824,7 @@ public:
protected:
_LIBCPP_ALWAYS_INLINE
~money_get() {}
virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
@ -3277,7 +3325,7 @@ extern template class __money_put<char>;
extern template class __money_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class money_put
class _LIBCPP_VISIBLE money_put
: public locale::facet,
private __money_put<_CharT>
{
@ -3307,6 +3355,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~money_put() {}
virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
@ -3428,7 +3477,7 @@ extern template class money_put<wchar_t>;
// messages
class messages_base
class _LIBCPP_VISIBLE messages_base
{
public:
typedef nl_catd catalog;
@ -3437,7 +3486,7 @@ public:
};
template <class _CharT>
class messages
class _LIBCPP_VISIBLE messages
: public locale::facet,
public messages_base
{
@ -3471,6 +3520,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~messages() {}
virtual catalog do_open(const basic_string<char>&, const locale&) const;
@ -3517,7 +3567,7 @@ extern template class messages<char>;
extern template class messages<wchar_t>;
template <class _CharT>
class messages_byname
class _LIBCPP_VISIBLE messages_byname
: public messages<_CharT>
{
public:
@ -3533,6 +3583,7 @@ public:
: messages<_CharT>(__refs) {}
protected:
_LIBCPP_ALWAYS_INLINE
~messages_byname() {}
};
@ -3542,7 +3593,7 @@ extern template class messages_byname<wchar_t>;
template<class _Codecvt, class _Elem = wchar_t,
class _Wide_alloc = allocator<_Elem>,
class _Byte_alloc = allocator<char> >
class wstring_convert
class _LIBCPP_VISIBLE wstring_convert
{
public:
typedef basic_string<char, char_traits<char>, _Byte_alloc> byte_string;
@ -3569,28 +3620,36 @@ public:
#endif
~wstring_convert();
_LIBCPP_ALWAYS_INLINE
wide_string from_bytes(char __byte)
{return from_bytes(&__byte, &__byte+1);}
_LIBCPP_ALWAYS_INLINE
wide_string from_bytes(const char* __ptr)
{return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));}
_LIBCPP_ALWAYS_INLINE
wide_string from_bytes(const byte_string& __str)
{return from_bytes(__str.data(), __str.data() + __str.size());}
wide_string from_bytes(const char* __first, const char* __last);
_LIBCPP_ALWAYS_INLINE
byte_string to_bytes(_Elem __wchar)
{return to_bytes(&__wchar, &__wchar+1);}
_LIBCPP_ALWAYS_INLINE
byte_string to_bytes(const _Elem* __wptr)
{return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));}
_LIBCPP_ALWAYS_INLINE
byte_string to_bytes(const wide_string& __wstr)
{return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());}
byte_string to_bytes(const _Elem* __first, const _Elem* __last);
_LIBCPP_ALWAYS_INLINE
size_t converted() const {return __cvtcount_;}
_LIBCPP_ALWAYS_INLINE
state_type state() const {return __cvtstate_;}
};
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline
inline _LIBCPP_ALWAYS_INLINE
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt)
: __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
@ -3598,7 +3657,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
}
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline
inline _LIBCPP_ALWAYS_INLINE
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt, state_type __state)
: __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
@ -3617,7 +3676,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline
inline _LIBCPP_ALWAYS_INLINE
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(wstring_convert&& __wc)
: __byte_err_string_(_STD::move(__wc.__byte_err_string_)),
@ -3785,7 +3844,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
}
template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> >
class wbuffer_convert
class _LIBCPP_VISIBLE wbuffer_convert
: public basic_streambuf<_Elem, _Tr>
{
public:
@ -3820,7 +3879,9 @@ public:
state_type __state = state_type());
~wbuffer_convert();
_LIBCPP_INLINE_VISIBILITY
streambuf* rdbuf() const {return __bufptr_;}
_LIBCPP_INLINE_VISIBILITY
streambuf* rdbuf(streambuf* __bytebuf)
{
streambuf* __r = __bufptr_;
@ -3828,6 +3889,7 @@ public:
return __r;
}
_LIBCPP_INLINE_VISIBILITY
state_type state() const {return __st_;}
protected:

View File

@ -353,37 +353,39 @@ class __map_value_compare
typedef pair<_Key, _Tp> _P;
typedef pair<const _Key, _Tp> _CP;
public:
_LIBCPP_INLINE_VISIBILITY
__map_value_compare() : _Compare() {}
_LIBCPP_INLINE_VISIBILITY
__map_value_compare(_Compare c) : _Compare(c) {}
_LIBCPP_INLINE_VISIBILITY
const _Compare& key_comp() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _P& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _P& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _P& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y);}
// bool operator()(const _Tp& __x, const _Tp& __y) const
// {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
// bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
// {return static_cast<const _Compare&>(*this)(__x, __y.first);}
// bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
// {return static_cast<const _Compare&>(*this)(__x.first, __y);}
// bool operator()(const typename _Tp::first_type& __x,
// const typename _Tp::first_type& __y) const
// {return static_cast<const _Compare&>(*this)(__x, __y);}
};
template <class _Key, class _Tp, class _Compare>
@ -395,38 +397,40 @@ class __map_value_compare<_Key, _Tp, _Compare, false>
typedef pair<const _Key, _Tp> _CP;
public:
_LIBCPP_INLINE_VISIBILITY
__map_value_compare() : comp() {}
_LIBCPP_INLINE_VISIBILITY
__map_value_compare(_Compare c) : comp(c) {}
_LIBCPP_INLINE_VISIBILITY
const _Compare& key_comp() const {return comp;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _CP& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _P& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const
{return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _CP& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _P& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _Key& __y) const
{return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _P& __y) const
{return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
{return comp(__x, __y);}
// bool operator()(const _Tp& __x, const _Tp& __y) const
// {return comp(__x.first, __y.first);}
// bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
// {return comp(__x, __y.first);}
// bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
// {return comp(__x.first, __y);}
// bool operator()(const typename _Tp::first_type& __x,
// const typename _Tp::first_type& __y) const
// {return comp(__x, __y);}
};
template <class _Allocator>
@ -449,6 +453,7 @@ public:
bool __first_constructed;
bool __second_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __map_node_destructor(allocator_type& __na)
: __na_(__na),
__first_constructed(false),
@ -456,6 +461,7 @@ public:
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__map_node_destructor(__tree_node_destructor<allocator_type>&& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@ -465,6 +471,7 @@ public:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__second_constructed)
@ -481,7 +488,7 @@ template <class, class, class, class> class multimap;
template <class> class __map_const_iterator;
template <class _TreeIterator>
class __map_iterator
class _LIBCPP_VISIBLE __map_iterator
{
_TreeIterator __i_;
@ -501,14 +508,20 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__map_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__map_iterator(_TreeIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__map_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__map_iterator operator++(int)
{
__map_iterator __t(*this);
@ -516,7 +529,9 @@ public:
return __t;
}
_LIBCPP_INLINE_VISIBILITY
__map_iterator& operator--() {--__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__map_iterator operator--(int)
{
__map_iterator __t(*this);
@ -524,18 +539,21 @@ public:
return __t;
}
friend bool operator==(const __map_iterator& __x, const __map_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __map_iterator& __x, const __map_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
friend
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class> friend class map;
template <class, class, class, class> friend class multimap;
template <class> friend class __map_const_iterator;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
};
template <class _TreeIterator>
class __map_const_iterator
class _LIBCPP_VISIBLE __map_const_iterator
{
_TreeIterator __i_;
@ -555,17 +573,24 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator(_TreeIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator(
__map_iterator<typename _TreeIterator::__non_const_iterator> __i)
: __i_(__i.__i_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator operator++(int)
{
__map_const_iterator __t(*this);
@ -573,7 +598,9 @@ public:
return __t;
}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator& operator--() {--__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator operator--(int)
{
__map_const_iterator __t(*this);
@ -581,19 +608,21 @@ public:
return __t;
}
friend bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class> friend class map;
template <class, class, class, class> friend class multimap;
template <class, class, class> friend class __tree_const_iterator;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
};
template <class _Key, class _Tp, class _Compare = less<_Key>,
class _Allocator = allocator<pair<const _Key, _Tp> > >
class map
class _LIBCPP_VISIBLE map
{
public:
// types:
@ -605,15 +634,16 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
class value_compare
class _LIBCPP_VISIBLE value_compare
: public binary_function<value_type, value_type, bool>
{
friend class map;
protected:
key_compare comp;
value_compare(key_compare c) : comp(c) {}
_LIBCPP_INLINE_VISIBILITY value_compare(key_compare c) : comp(c) {}
public:
_LIBCPP_INLINE_VISIBILITY
bool operator()(const value_type& __x, const value_type& __y) const
{return comp(__x.first, __y.first);}
};
@ -644,13 +674,16 @@ public:
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit map(const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {}
_LIBCPP_INLINE_VISIBILITY
explicit map(const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
map(_InputIterator __f, _InputIterator __l,
const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@ -659,6 +692,7 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
map(_InputIterator __f, _InputIterator __l,
const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a)
@ -666,6 +700,7 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
map(const map& __m)
: __tree_(__m.__tree_)
{
@ -674,6 +709,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
map(map&& __m)
: __tree_(_STD::move(__m.__tree_))
{
@ -681,24 +717,28 @@ public:
map(map&& __m, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
map& operator=(map&& __m)
{
__tree_ = _STD::move(__m.__tree_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
map& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_unique(__il.begin(), __il.end());
@ -707,34 +747,51 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit map(const allocator_type& __a)
: __tree_(__a)
{
}
_LIBCPP_INLINE_VISIBILITY
map(const map& __m, const allocator_type& __a)
: __tree_(__m.__tree_.value_comp(), __a)
{
insert(__m.begin(), __m.end());
}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();}
mapped_type& operator[](const key_type& __k);
@ -745,17 +802,22 @@ public:
mapped_type& at(const key_type& __k);
const mapped_type& at(const key_type& __k) const;
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp().key_comp();}
_LIBCPP_INLINE_VISIBILITY
value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
emplace() {return __tree_.__emplace_unique();}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
emplace(_A0&& __a0)
{return __tree_.__emplace_unique(_STD::forward<_A0>(__a0));}
@ -769,12 +831,14 @@ public:
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p)
{return __tree_.__emplace_hint_unique(__p.__i_);}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p, _A0&& __a0)
{return __tree_.__emplace_hint_unique(__p.__i_, _STD::forward<_A0>(__a0));}
@ -790,56 +854,76 @@ public:
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_P&& __p)
{return __tree_.__insert_unique(_STD::forward<_P>(__p));}
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _P&& __p)
{return __tree_.__insert_unique(__pos.__i_, _STD::forward<_P>(__p));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
insert(const value_type& __v) {return __tree_.__insert_unique(__v);}
_LIBCPP_INLINE_VISIBILITY
iterator
insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_unique(__p.__i_, __v);}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
insert(__e.__i_, *__f);
}
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k)
{return __tree_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f.__i_, __l.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(map& __m) {__tree_.swap(__m.__tree_);}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_unique(__k);}
@ -1202,7 +1286,7 @@ map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1211,7 +1295,7 @@ operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1220,7 +1304,7 @@ operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1229,7 +1313,7 @@ operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1238,7 +1322,7 @@ operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1247,7 +1331,7 @@ operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1256,7 +1340,7 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
map<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1266,7 +1350,7 @@ swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
template <class _Key, class _Tp, class _Compare = less<_Key>,
class _Allocator = allocator<pair<const _Key, _Tp> > >
class multimap
class _LIBCPP_VISIBLE multimap
{
public:
// types:
@ -1278,15 +1362,17 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
class value_compare
class _LIBCPP_VISIBLE value_compare
: public binary_function<value_type, value_type, bool>
{
friend class multimap;
protected:
key_compare comp;
_LIBCPP_INLINE_VISIBILITY
value_compare(key_compare c) : comp(c) {}
public:
_LIBCPP_INLINE_VISIBILITY
bool operator()(const value_type& __x, const value_type& __y) const
{return comp(__x.first, __y.first);}
};
@ -1317,13 +1403,16 @@ public:
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {}
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multimap(_InputIterator __f, _InputIterator __l,
const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@ -1332,6 +1421,7 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multimap(_InputIterator __f, _InputIterator __l,
const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a)
@ -1339,6 +1429,7 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
multimap(const multimap& __m)
: __tree_(__m.__tree_.value_comp(),
__alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc()))
@ -1348,6 +1439,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multimap(multimap&& __m)
: __tree_(_STD::move(__m.__tree_))
{
@ -1355,24 +1447,28 @@ public:
multimap(multimap&& __m, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(multimap&& __m)
{
__tree_ = _STD::move(__m.__tree_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_multi(__il.begin(), __il.end());
@ -1380,46 +1476,68 @@ public:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const allocator_type& __a)
: __tree_(__a)
{
}
_LIBCPP_INLINE_VISIBILITY
multimap(const multimap& __m, const allocator_type& __a)
: __tree_(__m.__tree_.value_comp(), __a)
{
insert(__m.begin(), __m.end());
}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();}
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp().key_comp();}
_LIBCPP_INLINE_VISIBILITY
value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator emplace() {return __tree_.__emplace_multi();}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace(_A0&& __a0)
{return __tree_.__emplace_multi(_STD::forward<_A0>(__a0));}
@ -1433,11 +1551,13 @@ public:
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p)
{return __tree_.__emplace_hint_multi(__p.__i_);}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p, _A0&& __a0)
{return __tree_.__emplace_hint_multi(__p.__i_, _STD::forward<_A0>(__a0));}
@ -1453,53 +1573,73 @@ public:
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(_P&& __p)
{return __tree_.__insert_multi(_STD::forward<_P>(__p));}
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _P&& __p)
{return __tree_.__insert_multi(__pos.__i_, _STD::forward<_P>(__p));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_multi(__p.__i_, __v);}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
__tree_.__insert_multi(__e.__i_, *__f);
}
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f.__i_, __l.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(multimap& __m) {__tree_.swap(__m.__tree_);}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_multi(__k);}
@ -1623,7 +1763,7 @@ multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1632,7 +1772,7 @@ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1641,7 +1781,7 @@ operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1650,7 +1790,7 @@ operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1659,7 +1799,7 @@ operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1668,7 +1808,7 @@ operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@ -1677,7 +1817,7 @@ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
multimap<_Key, _Tp, _Compare, _Allocator>& __y)

View File

@ -531,7 +531,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// allocator_arg_t
struct allocator_arg_t { };
struct _LIBCPP_VISIBLE allocator_arg_t { };
extern const allocator_arg_t allocator_arg;
@ -548,7 +548,7 @@ addressof(_Tp& __x)
template <class _Tp> class allocator;
template <>
class allocator<void>
class _LIBCPP_VISIBLE allocator<void>
{
public:
typedef void* pointer;
@ -783,7 +783,7 @@ struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, false>
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Ptr>
struct pointer_traits
struct _LIBCPP_VISIBLE pointer_traits
{
typedef _Ptr pointer;
typedef typename __pointer_traits_element_type<pointer>::type element_type;
@ -799,13 +799,14 @@ struct pointer_traits
private:
struct __nat {};
public:
_LIBCPP_INLINE_VISIBILITY
static pointer pointer_to(typename conditional<is_void<element_type>::value,
__nat, element_type>::type& __r)
{return pointer::pointer_to(__r);}
};
template <class _Tp>
struct pointer_traits<_Tp*>
struct _LIBCPP_VISIBLE pointer_traits<_Tp*>
{
typedef _Tp* pointer;
typedef _Tp element_type;
@ -820,6 +821,7 @@ struct pointer_traits<_Tp*>
private:
struct __nat {};
public:
_LIBCPP_INLINE_VISIBILITY
static pointer pointer_to(typename conditional<is_void<element_type>::value,
__nat, element_type>::type& __r)
{return _STD::addressof(__r);}
@ -1291,7 +1293,7 @@ struct __has_select_on_container_copy_construction
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
template <class _Alloc>
struct allocator_traits
struct _LIBCPP_VISIBLE allocator_traits
{
typedef _Alloc allocator_type;
typedef typename allocator_type::value_type value_type;
@ -1322,38 +1324,46 @@ struct allocator_traits
{typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n)
{return __a.allocate(__n);}
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
{return allocate(__a, __n, __hint,
__has_allocate_hint<allocator_type, size_type, const_void_pointer>());}
_LIBCPP_INLINE_VISIBILITY
static void deallocate(allocator_type& __a, pointer __p, size_type __n)
{__a.deallocate(__p, __n);}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args)
{__construct(__has_construct<allocator_type, pointer, _Args...>(),
__a, __p, _STD::forward<_Args>(__args)...);}
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p)
{
::new ((void*)__p) _Tp();
}
template <class _Tp, class _A0>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0)
{
::new ((void*)__p) _Tp(__a0);
}
template <class _Tp, class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0,
const _A1& __a1)
{
::new ((void*)__p) _Tp(__a0, __a1);
}
template <class _Tp, class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0,
const _A1& __a1, const _A2& __a2)
{
@ -1362,12 +1372,15 @@ struct allocator_traits
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
static void destroy(allocator_type& __a, _Tp* __p)
{__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
_LIBCPP_INLINE_VISIBILITY
static size_type max_size(const allocator_type& __a)
{return __max_size(__has_max_size<const allocator_type>(), __a);}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
select_on_container_copy_construction(const allocator_type& __a)
{return select_on_container_copy_construction(
@ -1376,18 +1389,22 @@ struct allocator_traits
private:
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n,
const_void_pointer __hint, true_type)
{return __a.allocate(__n, __hint);}
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n,
const_void_pointer __hint, false_type)
{return __a.allocate(__n);}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args)
{__a.construct(__p, _STD::forward<_Args>(__args)...);}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args)
{
::new ((void*)__p) _Tp(_STD::forward<_Args>(__args)...);
@ -1395,22 +1412,28 @@ private:
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
static void __destroy(true_type, allocator_type& __a, _Tp* __p)
{__a.destroy(__p);}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
static void __destroy(false_type, allocator_type&, _Tp* __p)
{
__p->~_Tp();
}
_LIBCPP_INLINE_VISIBILITY
static size_type __max_size(true_type, const allocator_type& __a)
{return __a.max_size();}
_LIBCPP_INLINE_VISIBILITY
static size_type __max_size(false_type, const allocator_type&)
{return numeric_limits<size_type>::max();}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
select_on_container_copy_construction(true_type, const allocator_type& __a)
{return __a.select_on_container_copy_construction();}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
select_on_container_copy_construction(false_type, const allocator_type& __a)
{return __a;}
@ -1443,7 +1466,7 @@ struct __uses_allocator<_Tp, _Alloc, false>
};
template <class _Tp, class _Alloc>
struct uses_allocator
struct _LIBCPP_VISIBLE uses_allocator
: public __uses_allocator<_Tp, _Alloc>
{
};
@ -1581,7 +1604,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) throw() {return false;}
template <class _OutputIterator, class _Tp>
class raw_storage_iterator
class _LIBCPP_VISIBLE raw_storage_iterator
: public iterator<output_iterator_tag,
_Tp, // purposefully not C++03
ptrdiff_t, // purposefully not C++03
@ -1634,7 +1657,7 @@ struct auto_ptr_ref
};
template<class _Tp>
class auto_ptr
class _LIBCPP_VISIBLE auto_ptr
{
private:
_Tp* __ptr_;
@ -1678,7 +1701,7 @@ public:
};
template <>
class auto_ptr<void>
class _LIBCPP_VISIBLE auto_ptr<void>
{
public:
typedef void element_type;
@ -1918,7 +1941,7 @@ swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
{__x.swap(__y);}
template <class _Tp>
struct default_delete
struct _LIBCPP_VISIBLE default_delete
{
_LIBCPP_INLINE_VISIBILITY default_delete() {}
template <class _Up>
@ -1932,7 +1955,7 @@ struct default_delete
};
template <class _Tp>
struct default_delete<_Tp[]>
struct _LIBCPP_VISIBLE default_delete<_Tp[]>
{
_LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const
{
@ -1944,7 +1967,7 @@ private:
};
template <class _Tp, class _Dp = default_delete<_Tp> >
class unique_ptr
class _LIBCPP_VISIBLE unique_ptr
{
public:
typedef _Tp element_type;
@ -2121,7 +2144,7 @@ public:
};
template <class _Tp, class _Dp>
class unique_ptr<_Tp[], _Dp>
class _LIBCPP_VISIBLE unique_ptr<_Tp[], _Dp>
{
public:
typedef _Tp element_type;
@ -2356,9 +2379,10 @@ operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {re
template <class> struct hash;
template<class _Tp>
struct hash<_Tp*>
struct _LIBCPP_VISIBLE hash<_Tp*>
: public unary_function<_Tp*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(_Tp* __v) const
{
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
@ -2367,10 +2391,11 @@ struct hash<_Tp*>
};
template <class _Tp, class _Dp>
struct hash<unique_ptr<_Tp, _Dp> >
struct _LIBCPP_VISIBLE hash<unique_ptr<_Tp, _Dp> >
{
typedef unique_ptr<_Tp, _Dp> argument_type;
typedef size_t result_type;
_LIBCPP_INLINE_VISIBILITY
result_type operator()(const argument_type& __ptr) const
{
typedef typename argument_type::pointer pointer;
@ -2429,6 +2454,7 @@ private:
public:
_LIBCPP_INLINE_VISIBILITY __allocator_destructor(_Alloc& __a, size_type __s)
: __alloc_(__a), __s_(__s) {}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p) {__alloc_traits::deallocate(__alloc_, __p, __s_);}
};
@ -2482,7 +2508,7 @@ uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
__h.release();
}
class bad_weak_ptr
class _LIBCPP_EXCEPTION_ABI bad_weak_ptr
: public std::exception
{
public:
@ -2504,11 +2530,13 @@ private:
virtual void __on_zero_shared() = 0;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __shared_count(long __refs = 0)
: __shared_owners_(__refs) {}
void __add_shared();
void __release_shared();
_LIBCPP_INLINE_VISIBILITY
long use_count() const {return __shared_owners_ + 1;}
};
@ -2518,6 +2546,7 @@ class __shared_weak_count
long __shared_weak_owners_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __shared_weak_count(long __refs = 0)
: __shared_count(__refs),
__shared_weak_owners_(__refs) {}
@ -2529,6 +2558,7 @@ public:
void __add_weak();
void __release_shared();
void __release_weak();
_LIBCPP_INLINE_VISIBILITY
long use_count() const {return __shared_count::use_count();}
__shared_weak_count* lock();
@ -2545,6 +2575,7 @@ class __shared_ptr_pointer
{
__compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_;
public:
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
: __data_(__compressed_pair<_Tp, _Dp>(__p, _STD::move(__d)), _STD::move(__a)) {}
@ -2593,27 +2624,33 @@ class __shared_ptr_emplace
public:
#ifndef _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a)
: __data_(_STD::move(__a)) {}
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
: __data_(_STD::move(__a), _Tp(_STD::forward<_Args>(__args)...)) {}
#else // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a)
: __data_(__a) {}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a, _A0& __a0)
: __data_(__a, _Tp(__a0)) {}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1)
: __data_(__a, _Tp(__a0, __a1)) {}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1, _A2& __a2)
: __data_(__a, _Tp(__a0, __a1, __a2)) {}
@ -2623,6 +2660,7 @@ private:
virtual void __on_zero_shared();
virtual void __on_zero_shared_weak();
public:
_LIBCPP_INLINE_VISIBILITY
_Tp* get() {return &__data_.second();}
};
@ -2645,7 +2683,7 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak()
template<class _Tp> class enable_shared_from_this;
template<class _Tp>
class shared_ptr
class _LIBCPP_VISIBLE shared_ptr
{
public:
typedef _Tp element_type;
@ -2720,20 +2758,32 @@ public:
template<class _Yp, class _Dp> void reset(_Yp* __p, _Dp __d);
template<class _Yp, class _Dp, class _Alloc> void reset(_Yp* __p, _Dp __d, _Alloc __a);
_LIBCPP_INLINE_VISIBILITY
element_type* get() const {return __ptr_;}
_LIBCPP_INLINE_VISIBILITY
typename add_lvalue_reference<element_type>::type operator*() const {return *__ptr_;}
_LIBCPP_INLINE_VISIBILITY
element_type* operator->() const {return __ptr_;}
_LIBCPP_INLINE_VISIBILITY
long use_count() const {return __cntrl_ ? __cntrl_->use_count() : 0;}
_LIBCPP_INLINE_VISIBILITY
bool unique() const {return use_count() == 1;}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __cntrl_ == 0;}
_LIBCPP_INLINE_VISIBILITY
/*explicit*/ operator bool() const {return get() != 0;}
template <class _U> bool owner_before(shared_ptr<_U> const& __p) const
template <class _U>
_LIBCPP_INLINE_VISIBILITY
bool owner_before(shared_ptr<_U> const& __p) const
{return __cntrl_ < __p.__cntrl_;}
template <class _U> bool owner_before(weak_ptr<_U> const& __p) const
template <class _U>
_LIBCPP_INLINE_VISIBILITY
bool owner_before(weak_ptr<_U> const& __p) const
{return __cntrl_ < __p.__cntrl_;}
#ifndef _LIBCPP_NO_RTTI
template <class _Dp>
_LIBCPP_INLINE_VISIBILITY
_Dp* __get_deleter() const
{return (_Dp*)(__cntrl_ ? __cntrl_->__get_deleter(typeid(_Dp)) : 0);}
#endif // _LIBCPP_NO_RTTI
@ -2784,6 +2834,7 @@ public:
private:
template <class _Yp>
_LIBCPP_INLINE_VISIBILITY
void
__enable_weak_this(const enable_shared_from_this<_Yp>* __e)
{
@ -2791,10 +2842,11 @@ private:
__e->__weak_this_ = *this;
}
_LIBCPP_INLINE_VISIBILITY
void __enable_weak_this(const void*) {}
template <class _Up> friend class shared_ptr;
template <class _Up> friend class weak_ptr;
template <class _Up> friend class _LIBCPP_VISIBLE shared_ptr;
template <class _Up> friend class _LIBCPP_VISIBLE weak_ptr;
};
template<class _Tp>
@ -3504,7 +3556,7 @@ get_deleter(const shared_ptr<_Tp>& __p)
#endif // _LIBCPP_NO_RTTI
template<class _Tp>
class weak_ptr
class _LIBCPP_VISIBLE weak_ptr
{
public:
typedef _Tp element_type;
@ -3529,16 +3581,22 @@ public:
void swap(weak_ptr& __r);
void reset();
_LIBCPP_INLINE_VISIBILITY
long use_count() const {return __cntrl_ ? __cntrl_->use_count() : 0;}
_LIBCPP_INLINE_VISIBILITY
bool expired() const {return __cntrl_ == 0 || __cntrl_->use_count() == 0;}
shared_ptr<_Tp> lock() const;
template<class _Up> bool owner_before(const shared_ptr<_Up>& __r) const
template<class _Up>
_LIBCPP_INLINE_VISIBILITY
bool owner_before(const shared_ptr<_Up>& __r) const
{return __cntrl_ < __r.__cntrl_;}
template<class _Up> bool owner_before(const weak_ptr<_Up>& __r) const
template<class _Up>
_LIBCPP_INLINE_VISIBILITY
bool owner_before(const weak_ptr<_Up>& __r) const
{return __cntrl_ < __r.__cntrl_;}
template <class _Up> friend class weak_ptr;
template <class _Up> friend class shared_ptr;
template <class _Up> friend class _LIBCPP_VISIBLE weak_ptr;
template <class _Up> friend class _LIBCPP_VISIBLE shared_ptr;
};
template<class _Tp>
@ -3673,52 +3731,65 @@ weak_ptr<_Tp>::lock() const
template <class _Tp> struct owner_less;
template <class _Tp>
struct owner_less<shared_ptr<_Tp> >
struct _LIBCPP_VISIBLE owner_less<shared_ptr<_Tp> >
: binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool>
{
typedef bool result_type;
_LIBCPP_INLINE_VISIBILITY
bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
};
template <class _Tp>
struct owner_less<weak_ptr<_Tp> >
struct _LIBCPP_VISIBLE owner_less<weak_ptr<_Tp> >
: binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool>
{
typedef bool result_type;
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
};
template<class _Tp>
class enable_shared_from_this
class _LIBCPP_VISIBLE enable_shared_from_this
{
mutable weak_ptr<_Tp> __weak_this_;
protected:
_LIBCPP_INLINE_VISIBILITY
enable_shared_from_this() {}
_LIBCPP_INLINE_VISIBILITY
enable_shared_from_this(enable_shared_from_this const&) {}
_LIBCPP_INLINE_VISIBILITY
enable_shared_from_this& operator=(enable_shared_from_this const&) {return *this;}
_LIBCPP_INLINE_VISIBILITY
~enable_shared_from_this() {}
public:
_LIBCPP_INLINE_VISIBILITY
shared_ptr<_Tp> shared_from_this() {return shared_ptr<_Tp>(__weak_this_);}
_LIBCPP_INLINE_VISIBILITY
shared_ptr<_Tp const> shared_from_this() const {return shared_ptr<const _Tp>(__weak_this_);}
template <class _Up> friend class shared_ptr;
};
template <class _Tp>
struct hash<shared_ptr<_Tp> >
struct _LIBCPP_VISIBLE hash<shared_ptr<_Tp> >
{
typedef shared_ptr<_Tp> argument_type;
typedef size_t result_type;
_LIBCPP_INLINE_VISIBILITY
result_type operator()(const argument_type& __ptr) const
{
return hash<_Tp*>()(__ptr.get());
@ -3726,7 +3797,7 @@ struct hash<shared_ptr<_Tp> >
};
//enum class
struct pointer_safety
struct _LIBCPP_VISIBLE pointer_safety
{
enum _
{
@ -3737,7 +3808,9 @@ struct pointer_safety
_ __v_;
_LIBCPP_INLINE_VISIBILITY
pointer_safety(_ __v) : __v_(__v) {}
_LIBCPP_INLINE_VISIBILITY
operator int() const {return __v_;}
};