visibility-decoration.

llvm-svn: 114451
This commit is contained in:
Howard Hinnant 2010-09-21 17:32:39 +00:00
parent 5e39ffd02f
commit 43d9923860
5 changed files with 199 additions and 107 deletions

View File

@ -1028,6 +1028,7 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
}
template <class _C, bool _IC1, bool _IC2>
inline _LIBCPP_INLINE_VISIBILITY
bool
equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
{

View File

@ -196,12 +196,12 @@ mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) 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
{
@ -396,8 +396,9 @@ class __func<_F, _Alloc, _R(_A0)>
{
__compressed_pair<_F, _Alloc> __f_;
public:
explicit __func(_F __f) : __f_(_STD::move(__f)) {}
explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
_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(_A0)>* __clone() const;
virtual void __clone(__base<_R(_A0)>*) const;
virtual void destroy();
@ -478,8 +479,9 @@ class __func<_F, _Alloc, _R(_A0, _A1)>
{
__compressed_pair<_F, _Alloc> __f_;
public:
explicit __func(_F __f) : __f_(_STD::move(__f)) {}
explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
_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(_A0, _A1)>* __clone() const;
virtual void __clone(__base<_R(_A0, _A1)>*) const;
virtual void destroy();
@ -560,8 +562,9 @@ class __func<_F, _Alloc, _R(_A0, _A1, _A2)>
{
__compressed_pair<_F, _Alloc> __f_;
public:
explicit __func(_F __f) : __f_(_STD::move(__f)) {}
explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
_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(_A0, _A1, _A2)>* __clone() const;
virtual void __clone(__base<_R(_A0, _A1, _A2)>*) const;
virtual void destroy();
@ -639,7 +642,7 @@ __func<_F, _Alloc, _R(_A0, _A1, _A2)>::target_type() const
} // __function
template<class _R>
class function<_R()>
class _LIBCPP_VISIBLE function<_R()>
{
typedef __function::__base<_R()> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
@ -653,16 +656,18 @@ public:
typedef _R result_type;
// 20.7.16.2.1, construct/copy/destroy:
explicit function() : __f_(0) {}
function(nullptr_t) : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
template<class _F>
function(_F,
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&);
@ -685,18 +690,19 @@ public:
// 20.7.16.2.2, function modifiers:
void swap(function&);
template<class _F, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
void assign(_F __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
operator bool() const {return __f_;}
_LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
private:
// deleted overloads close possible hole in the type system
template<class _R2>
bool operator==(const function<_R2()>&);// = delete;
bool operator==(const function<_R2()>&) const;// = delete;
template<class _R2>
bool operator!=(const function<_R2()>&);// = delete;
bool operator!=(const function<_R2()>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
_R operator()() const;
@ -920,7 +926,7 @@ function<_R()>::target() const
#endif // _LIBCPP_NO_RTTI
template<class _R, class _A0>
class function<_R(_A0)>
class _LIBCPP_VISIBLE function<_R(_A0)>
: public unary_function<_A0, _R>
{
typedef __function::__base<_R(_A0)> __base;
@ -928,33 +934,42 @@ class function<_R(_A0)>
__base* __f_;
template <class _F>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _F&) {return true;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0)) {return __p;}
template <class _R2, class _C>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)()) {return __p;}
template <class _R2, class _C>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)() const) {return __p;}
template <class _R2, class _C>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)() volatile) {return __p;}
template <class _R2, class _C>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)() const volatile) {return __p;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R(_B0)>& __p) {return __p;}
public:
typedef _R result_type;
// 20.7.16.2.1, construct/copy/destroy:
explicit function() : __f_(0) {}
function(nullptr_t) : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
template<class _F>
function(_F,
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&);
@ -977,18 +992,19 @@ public:
// 20.7.16.2.2, function modifiers:
void swap(function&);
template<class _F, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
void assign(_F __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
operator bool() const {return __f_;}
_LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
private:
// deleted overloads close possible hole in the type system
template<class _R2, class _B0>
bool operator==(const function<_R2(_B0)>&);// = delete;
bool operator==(const function<_R2(_B0)>&) const;// = delete;
template<class _R2, class _B0>
bool operator!=(const function<_R2(_B0)>&);// = delete;
bool operator!=(const function<_R2(_B0)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
_R operator()(_A0) const;
@ -1212,7 +1228,7 @@ function<_R(_A0)>::target() const
#endif // _LIBCPP_NO_RTTI
template<class _R, class _A0, class _A1>
class function<_R(_A0, _A1)>
class _LIBCPP_VISIBLE function<_R(_A0, _A1)>
: public binary_function<_A0, _A1, _R>
{
typedef __function::__base<_R(_A0, _A1)> __base;
@ -1220,33 +1236,42 @@ class function<_R(_A0, _A1)>
__base* __f_;
template <class _F>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _F&) {return true;}
template <class _R2, class _B0, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0, _B1)) {return __p;}
template <class _R2, class _C, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1)) {return __p;}
template <class _R2, class _C, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1) const) {return __p;}
template <class _R2, class _C, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1) volatile) {return __p;}
template <class _R2, class _C, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1) const volatile) {return __p;}
template <class _R2, class _B0, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R(_B0, _B1)>& __p) {return __p;}
public:
typedef _R result_type;
// 20.7.16.2.1, construct/copy/destroy:
explicit function() : __f_(0) {}
function(nullptr_t) : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
template<class _F>
function(_F,
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&);
@ -1269,6 +1294,7 @@ public:
// 20.7.16.2.2, function modifiers:
void swap(function&);
template<class _F, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
void assign(_F __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
@ -1278,9 +1304,9 @@ public:
private:
// deleted overloads close possible hole in the type system
template<class _R2, class _B0, class _B1>
bool operator==(const function<_R2(_B0, _B1)>&);// = delete;
bool operator==(const function<_R2(_B0, _B1)>&) const;// = delete;
template<class _R2, class _B0, class _B1>
bool operator!=(const function<_R2(_B0, _B1)>&);// = delete;
bool operator!=(const function<_R2(_B0, _B1)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
_R operator()(_A0, _A1) const;
@ -1504,40 +1530,49 @@ function<_R(_A0, _A1)>::target() const
#endif // _LIBCPP_NO_RTTI
template<class _R, class _A0, class _A1, class _A2>
class function<_R(_A0, _A1, _A2)>
class _LIBCPP_VISIBLE function<_R(_A0, _A1, _A2)>
{
typedef __function::__base<_R(_A0, _A1, _A2)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _F>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _F&) {return true;}
template <class _R2, class _B0, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0, _B1, _B2)) {return __p;}
template <class _R2, class _C, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1, _B2)) {return __p;}
template <class _R2, class _C, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1, _B2) const) {return __p;}
template <class _R2, class _C, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1, _B2) volatile) {return __p;}
template <class _R2, class _C, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1, _B2) const volatile) {return __p;}
template <class _R2, class _B0, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R(_B0, _B1, _B2)>& __p) {return __p;}
public:
typedef _R result_type;
// 20.7.16.2.1, construct/copy/destroy:
explicit function() : __f_(0) {}
function(nullptr_t) : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
template<class _F>
function(_F,
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&);
@ -1560,18 +1595,19 @@ public:
// 20.7.16.2.2, function modifiers:
void swap(function&);
template<class _F, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
void assign(_F __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
operator bool() const {return __f_;}
_LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
private:
// deleted overloads close possible hole in the type system
template<class _R2, class _B0, class _B1, class _B2>
bool operator==(const function<_R2(_B0, _B1, _B2)>&);// = delete;
bool operator==(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
template<class _R2, class _B0, class _B1, class _B2>
bool operator!=(const function<_R2(_B0, _B1, _B2)>&);// = delete;
bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
_R operator()(_A0, _A1, _A2) const;
@ -1822,11 +1858,11 @@ swap(function<_F>& __x, function<_F>& __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

View File

@ -21,21 +21,21 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
struct unary_function
struct _LIBCPP_VISIBLE unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
template <class _Arg1, class _Arg2, class _Result>
struct binary_function
struct _LIBCPP_VISIBLE binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
template <class _Tp> struct hash;
template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <class _Tp>
struct __has_result_type
@ -445,7 +445,7 @@ struct __invoke_return
};
template <class _Tp>
class reference_wrapper
class _LIBCPP_VISIBLE reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@ -467,6 +467,7 @@ public:
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{

View File

@ -996,7 +996,7 @@ struct __invoke_return2
};
template <class _Tp>
class reference_wrapper
class _LIBCPP_VISIBLE reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@ -1015,6 +1015,7 @@ public:
// invoke
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type&>::type
operator() () const
{
@ -1022,6 +1023,7 @@ public:
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type&, _A0>::type
operator() (_A0& __a0) const
{
@ -1029,6 +1031,7 @@ public:
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type&, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const
{
@ -1036,6 +1039,7 @@ public:
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type&, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
{

View File

@ -22,6 +22,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_VISIBLE
size_t __next_prime(size_t);
template <class _NodePtr>
@ -32,7 +33,7 @@ struct __hash_node_base
pointer __next_;
__hash_node_base() : __next_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
};
template <class _Tp, class _VoidPtr>
@ -57,10 +58,10 @@ template <class, class, class, class> class __hash_table;
template <class> class __hash_const_iterator;
template <class> class __hash_map_iterator;
template <class> class __hash_map_const_iterator;
template <class, class, class, class, class> class unordered_map;
template <class, class, class, class, class> class _LIBCPP_VISIBLE unordered_map;
template <class _NodePtr>
class __hash_iterator
class _LIBCPP_VISIBLE __hash_iterator
{
typedef _NodePtr __node_pointer;
@ -79,17 +80,21 @@ public:
#endif
pointer;
__hash_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_iterator() {}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_iterator& operator++()
{
__node_ = __node_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_iterator operator++(int)
{
__hash_iterator __t(*this);
@ -97,25 +102,28 @@ public:
return __t;
}
friend bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_iterator(__node_pointer __node)
: __node_(__node)
{}
template <class, class, class, class> friend class __hash_table;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_map_iterator;
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
};
template <class _ConstNodePtr>
class __hash_const_iterator
class _LIBCPP_VISIBLE __hash_const_iterator
{
typedef _ConstNodePtr __node_pointer;
@ -146,20 +154,25 @@ public:
__non_const_node_pointer;
typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator;
__hash_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator(const __non_const_iterator& __x)
: __node_(__x.__node_)
{}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator& operator++()
{
__node_ = __node_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator operator++(int)
{
__hash_const_iterator __t(*this);
@ -167,26 +180,29 @@ public:
return __t;
}
friend bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator(__node_pointer __node)
: __node_(__node)
{}
template <class, class, class, class> friend class __hash_table;
template <class> friend class __hash_map_const_iterator;
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
};
template <class> class __hash_const_local_iterator;
template <class> class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class _NodePtr>
class __hash_local_iterator
class _LIBCPP_VISIBLE __hash_local_iterator
{
typedef _NodePtr __node_pointer;
@ -208,11 +224,14 @@ public:
#endif
pointer;
__hash_local_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() {}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator& operator++()
{
__node_ = __node_->__next_;
@ -221,6 +240,7 @@ public:
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator operator++(int)
{
__hash_local_iterator __t(*this);
@ -228,12 +248,15 @@ public:
return __t;
}
friend bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator(__node_pointer __node, size_t __bucket,
size_t __bucket_count)
: __node_(__node),
@ -245,12 +268,12 @@ private:
}
template <class, class, class, class> friend class __hash_table;
template <class> friend class __hash_const_local_iterator;
template <class> friend class __hash_map_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
};
template <class _ConstNodePtr>
class __hash_const_local_iterator
class _LIBCPP_VISIBLE __hash_const_local_iterator
{
typedef _ConstNodePtr __node_pointer;
@ -285,16 +308,20 @@ public:
#endif
pointer;
__hash_const_local_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator(const __non_const_iterator& __x)
: __node_(__x.__node_),
__bucket_(__x.__bucket_),
__bucket_count_(__x.__bucket_count_)
{}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator& operator++()
{
__node_ = __node_->__next_;
@ -303,6 +330,7 @@ public:
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator operator++(int)
{
__hash_const_local_iterator __t(*this);
@ -310,12 +338,15 @@ public:
return __t;
}
friend bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator(__node_pointer __node, size_t __bucket,
size_t __bucket_count)
: __node_(__node),
@ -327,7 +358,7 @@ private:
}
template <class, class, class, class> friend class __hash_table;
template <class> friend class __hash_map_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
};
template <class _Alloc>
@ -341,13 +372,17 @@ class __bucket_list_deallocator
public:
typedef typename __alloc_traits::pointer pointer;
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator()
: __data_(0) {}
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(const allocator_type& __a, size_type __size)
: __data_(__size, __a) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
: __data_(_STD::move(__x.__data_))
{
@ -356,12 +391,13 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
size_type& size() {return __data_.first();}
size_type size() const {return __data_.first();}
_LIBCPP_INLINE_VISIBILITY size_type& size() {return __data_.first();}
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __data_.first();}
allocator_type& __alloc() {return __data_.second();}
const allocator_type& __alloc() const {return __data_.second();}
_LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __data_.second();}
_LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __data_.second();}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
__alloc_traits::deallocate(__alloc(), __p, size());
@ -387,11 +423,13 @@ private:
public:
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_node_destructor(allocator_type& __na)
: __na_(__na),
__value_constructed(false)
{}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__value_constructed)
@ -457,21 +495,21 @@ private:
__compressed_pair<float, key_equal> __p3_;
// --- Member data end ---
size_type& size() {return __p2_.first();}
_LIBCPP_INLINE_VISIBILITY size_type& size() {return __p2_.first();}
public:
size_type size() const {return __p2_.first();}
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __p2_.first();}
hasher& hash_function() {return __p2_.second();}
const hasher& hash_function() const {return __p2_.second();}
_LIBCPP_INLINE_VISIBILITY hasher& hash_function() {return __p2_.second();}
_LIBCPP_INLINE_VISIBILITY const hasher& hash_function() const {return __p2_.second();}
float& max_load_factor() {return __p3_.first();}
float max_load_factor() const {return __p3_.first();}
_LIBCPP_INLINE_VISIBILITY float& max_load_factor() {return __p3_.first();}
_LIBCPP_INLINE_VISIBILITY float max_load_factor() const {return __p3_.first();}
key_equal& key_eq() {return __p3_.second();}
const key_equal& key_eq() const {return __p3_.second();}
_LIBCPP_INLINE_VISIBILITY key_equal& key_eq() {return __p3_.second();}
_LIBCPP_INLINE_VISIBILITY const key_equal& key_eq() const {return __p3_.second();}
__node_allocator& __node_alloc() {return __p1_.second();}
const __node_allocator& __node_alloc() const {return __p1_.second();}
_LIBCPP_INLINE_VISIBILITY __node_allocator& __node_alloc() {return __p1_.second();}
_LIBCPP_INLINE_VISIBILITY const __node_allocator& __node_alloc() const {return __p1_.second();}
public:
typedef __hash_iterator<__node_pointer> iterator;
@ -501,6 +539,7 @@ public:
template <class _InputIterator>
void __assign_multi(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const
{
return allocator_traits<__pointer_allocator>::max_size(
@ -540,8 +579,10 @@ public:
void clear();
void rehash(size_type __n);
void reserve(size_type __n)
_LIBCPP_INLINE_VISIBILITY void reserve(size_type __n)
{rehash(static_cast<size_type>(ceil(__n / max_load_factor())));}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const
{
return __bucket_list_.get_deleter().size();
@ -553,6 +594,7 @@ public:
const_iterator end() const;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const _Key& __k) const
{return hash_function()(__k) % bucket_count();}
@ -593,24 +635,25 @@ public:
void swap(__hash_table& __u);
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const
{return __bucket_list_.get_deleter().__alloc().max_size();}
size_type bucket_size(size_type __n) const;
float load_factor() const
_LIBCPP_INLINE_VISIBILITY float load_factor() const
{
size_type __bc = bucket_count();
return __bc != 0 ? (float)size() / __bc : 0.f;
}
void max_load_factor(float __mlf)
_LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf)
{max_load_factor() = _STD::max(__mlf, load_factor());}
local_iterator begin(size_type __n)
_LIBCPP_INLINE_VISIBILITY local_iterator begin(size_type __n)
{return local_iterator(__bucket_list_[__n], __n, bucket_count());}
local_iterator end(size_type __n)
_LIBCPP_INLINE_VISIBILITY local_iterator end(size_type __n)
{return local_iterator(nullptr, __n, bucket_count());}
const_local_iterator cbegin(size_type __n) const
_LIBCPP_INLINE_VISIBILITY const_local_iterator cbegin(size_type __n) const
{return const_local_iterator(__bucket_list_[__n], __n, bucket_count());}
const_local_iterator cend(size_type __n) const
_LIBCPP_INLINE_VISIBILITY const_local_iterator cend(size_type __n) const
{return const_local_iterator(nullptr, __n, bucket_count());}
private:
void __rehash(size_type __n);
@ -626,26 +669,31 @@ private:
#endif
__node_holder __construct_node(const value_type& __v, size_t __hash);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __hash_table& __u)
{__copy_assign_alloc(__u, integral_constant<bool,
__node_traits::propagate_on_container_copy_assignment::value>());}
void __copy_assign_alloc(const __hash_table& __u, true_type);
void __copy_assign_alloc(const __hash_table& __u, false_type) {}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __hash_table& __u, false_type) {}
void __move_assign(__hash_table& __u, false_type);
void __move_assign(__hash_table& __u, true_type);
void __move_assign_alloc(__hash_table& __u)
_LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__hash_table& __u)
{__move_assign_alloc(__u, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__hash_table& __u, true_type)
{
__bucket_list_.get_deleter().__alloc() =
_STD::move(__u.__bucket_list_.get_deleter().__alloc());
__node_alloc() = _STD::move(__u.__node_alloc());
}
void __move_assign_alloc(__hash_table&, false_type) {}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__hash_table&, false_type) {}
template <class _A>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y)
@ -657,6 +705,7 @@ private:
}
template <class _A>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y, true_type)
@ -666,6 +715,7 @@ private:
}
template <class _A>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y, false_type) {}
@ -675,7 +725,7 @@ private:
};
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
: __p2_(0),
__p3_(1.0f)
@ -683,7 +733,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
const key_equal& __eql)
: __bucket_list_(nullptr, __bucket_list_deleter()),
@ -919,7 +969,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__hash_table<_Tp, _Hash, _Equal, _Alloc>&
__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
{
@ -999,7 +1049,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin()
{
@ -1007,7 +1057,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end()
{
@ -1015,7 +1065,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const
{
@ -1023,7 +1073,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const
{
@ -1629,7 +1679,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const
{