failure MEM_OVERLAP "The memory regions overlap",
failure MEM_NOT_REGISTERED "The memory region was not registered",
failure MEM_OUT_OF_RANGE "Memory region is out of supported range",
- failure SVC_REJECT "Service request was rejected",
+ failure SVC_REJECT "Service request was rejected",
failure SVC_RESOURCES "No resources to handle the service",
failure SVC_VOID "There is no service that could serve the request",
failure SVC_NO_CONNECTION "There is no connection established",
};
errors xomp XOMP_ERR_ {
- failure INVALID_WORKER_ARGS "The command line arguments are not XOMP worker",
- failure INVALID_MSG_FRAME "The supplied messaging frame was invalid",
- failure SPAWN_WORKER_FAILED "Spawning of the worker failed",
+ failure INVALID_WORKER_ARGS "The command line arguments are not XOMP worker",
+ failure BAD_INVOCATION "Domain was not spawned with worker args",
+ failure INVALID_MSG_FRAME "The supplied messaging frame was invalid",
+ failure SPAWN_WORKER_FAILED "Spawning of the worker failed",
+ failure MASTER_NOT_INIT "XOMP Master library has not been initialized",
+ failure WORKER_INIT_FAILED "Worker initialization failed",
};
++ [ ContStr Config.use_fp "-fno-omit-frame-pointer" ""]
commonCxxFlags = [ Str s | s <- [ "-nostdinc++",
- "-std=c++0x",
- "-fno-exceptions",
+ "-fexceptions",
+ "-DLIBCXX_CXX_ABI=libcxxabi",
"-I" ] ]
++ [ NoDep SrcTree "src" "/include/cxx" ]
++ [ ContStr Config.use_fp "-fno-omit-frame-pointer" ""]
stdCxxLibs arch =
[ In InstallTree arch "/lib/libcxx.a",
- Str "./libsupc++.a" ]
+ In InstallTree arch "/lib/libposixcompat.a"]
++ stdLibs arch
options arch archFamily = Options {
Str "-Wa,-march=k1om",
Str "-mk1om",
Str "-mtune=k1om",
- Str "-fno-builtin",
-- Apparently the MPSS gcc somehow incudes CMOVES?
Str "-fno-if-conversion",
-- Str "-mno-mmx",
cFlags = ArchDefaults.commonCFlags
++ ArchDefaults.commonFlags
++ ourCommonFlags
+ ++ [Str "-fno-builtin" ]
cxxFlags = ArchDefaults.commonCxxFlags
++ ArchDefaults.commonFlags
++ ourCommonFlags
+ ++ [Str "-std=gnu++0x"] -- XXX: with the Intel GCC 4.7.0 still experimental
cDefines = ArchDefaults.cDefines options
cxxCompiler :: Options -> String -> String -> String -> [ RuleToken ]
cxxCompiler opts phase src obj
| optArch opts == "x86_64" = X86_64.cxxCompiler opts phase src obj
+ | optArch opts == "k1om" = K1om.cxxCompiler opts phase src obj
| otherwise = [ ErrorMsg ("no C++ compiler for " ++ (optArch opts)) ]
makeCxxDepend opts phase src obj depfile
| optArch opts == "x86_64" =
X86_64.makeCxxDepend opts phase src obj depfile
+ | optArch opts == "k1om" =
+ K1om.makeCxxDepend opts phase src obj depfile
| otherwise = [ ErrorMsg ("no C++ dependency generator for " ++ (optArch opts)) ]
cToAssembler :: Options -> String -> String -> String -> String -> [ RuleToken ]
cxxlinker :: Options -> [String] -> [String] -> String -> [RuleToken]
cxxlinker opts objs libs bin
| optArch opts == "x86_64" = X86_64.cxxlinker opts objs libs bin
+ | optArch opts == "k1om" = K1om.cxxlinker opts objs libs bin
| otherwise = [ ErrorMsg ("Can't link C++ executables for " ++ (optArch opts)) ]
--
cxxFlags = ArchDefaults.commonCxxFlags
++ ArchDefaults.commonFlags
++ ourCommonFlags
+ ++ [Str "-std=gnu++11"]
cDefines = ArchDefaults.cDefines options
interface xomp "Xeon Phi openMP interface" {
+ rpc add_memory(in cap frame,
+ in uint64 addr,
+ in uint8 type,
+ out errval msgerr);
+
message do_work(uint64 fn,
uint64 arg,
uint64 tid,
* which does the same thing as pause but with a variable amount of delay.
* 750 cycles for now.
*/
- uint32_t wait = 750;
+ uint32_t wait_cyc = 750;
__asm__ __volatile__("0:\n\t"
"cmpl $0, %0\n\t"
"je 1f\n\t"
"1:\n\t"
"lock btsl $0, %0\n\t"
"jc 0b\n\t"
- : "+m" (*lock), "=r"(wait) : : "memory", "cc");
+ : "+m" (*lock), "=r"(wait_cyc) : : "memory", "cc");
#else
__asm__ __volatile__("0:\n\t"
"cmpl $0, %0\n\t"
#include <__config>
#include <algorithm>
+#include <__undef_min_max>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
+#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _C, bool _IsConst> class __bit_iterator;
-template <class _C> class __bit_const_reference;
+template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
+template <class _Cp> class __bit_const_reference;
+
+template <class _Tp>
+struct __has_storage_type
+{
+ static const bool value = false;
+};
-template <class _C>
+template <class _Cp, bool = __has_storage_type<_Cp>::value>
class __bit_reference
{
- typedef typename _C::__storage_type __storage_type;
- typedef typename _C::__storage_pointer __storage_pointer;
+ typedef typename _Cp::__storage_type __storage_type;
+ typedef typename _Cp::__storage_pointer __storage_pointer;
__storage_pointer __seg_;
__storage_type __mask_;
-#if defined(__clang__)
- friend typename _C::__self;
+#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
+ friend typename _Cp::__self;
#else
- friend class _C::__self;
+ friend class _Cp::__self;
#endif
- friend class __bit_const_reference<_C>;
- friend class __bit_iterator<_C, false>;
+ friend class __bit_const_reference<_Cp>;
+ friend class __bit_iterator<_Cp, false>;
public:
- _LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);}
- _LIBCPP_INLINE_VISIBILITY bool operator ~() const {return !static_cast<bool>(*this);}
+ _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
+ {return static_cast<bool>(*__seg_ & __mask_);}
+ _LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT
+ {return !static_cast<bool>(*this);}
_LIBCPP_INLINE_VISIBILITY
- __bit_reference& operator=(bool __x)
+ __bit_reference& operator=(bool __x) _NOEXCEPT
{
if (__x)
*__seg_ |= __mask_;
}
_LIBCPP_INLINE_VISIBILITY
- __bit_reference& operator=(const __bit_reference& __x) {return operator=(static_cast<bool>(__x));}
+ __bit_reference& operator=(const __bit_reference& __x) _NOEXCEPT
+ {return operator=(static_cast<bool>(__x));}
- _LIBCPP_INLINE_VISIBILITY void flip() {*__seg_ ^= __mask_;}
- _LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const
- {return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
+ _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
+ _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
+ {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
- __bit_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {}
+ __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
+ : __seg_(__s), __mask_(__m) {}
+};
+
+template <class _Cp>
+class __bit_reference<_Cp, false>
+{
};
-template <class _C, class _D>
-_LIBCPP_INLINE_VISIBILITY inline
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT
+{
+ bool __t = __x;
+ __x = __y;
+ __y = __t;
+}
+
+template <class _Cp, class _Dp>
+inline _LIBCPP_INLINE_VISIBILITY
void
-swap(__bit_reference<_C> __x, __bit_reference<_D> __y)
+swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
-template <class _C>
-_LIBCPP_INLINE_VISIBILITY inline
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
void
-swap(__bit_reference<_C> __x, bool& __y)
+swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
-template <class _C>
-_LIBCPP_INLINE_VISIBILITY inline
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
void
-swap(bool& __x, __bit_reference<_C> __y)
+swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
-template <class _C>
+template <class _Cp>
class __bit_const_reference
{
- typedef typename _C::__storage_type __storage_type;
- typedef typename _C::__const_storage_pointer __storage_pointer;
+ typedef typename _Cp::__storage_type __storage_type;
+ typedef typename _Cp::__const_storage_pointer __storage_pointer;
__storage_pointer __seg_;
__storage_type __mask_;
-#if defined(__clang__)
- friend typename _C::__self;
+#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
+ friend typename _Cp::__self;
#else
- friend class _C::__self;
+ friend class _Cp::__self;
#endif
- friend class __bit_iterator<_C, true>;
+ friend class __bit_iterator<_Cp, true>;
public:
_LIBCPP_INLINE_VISIBILITY
- __bit_const_reference(const __bit_reference<_C>& __x)
+ __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
- _LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT
+ {return static_cast<bool>(*__seg_ & __mask_);}
- _LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const
- {return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
+ _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
+ {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
- __bit_const_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {}
+ _LIBCPP_CONSTEXPR
+ __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
+ : __seg_(__s), __mask_(__m) {}
__bit_const_reference& operator=(const __bit_const_reference& __x);
};
// find
-template <class _C>
-__bit_iterator<_C, false>
-__find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, _IsConst>
+__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, _IsConst> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
- __storage_type __dn = _STD::min(__clz_f, __n);
+ __storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b = *__first.__seg_ & __m;
if (__b)
- return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
+ return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
+ if (__n == __dn)
+ return __first + __n;
__n -= __dn;
++__first.__seg_;
}
// do middle whole words
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
if (*__first.__seg_)
- return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(*__first.__seg_)));
+ return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(*__first.__seg_)));
// do last partial word
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b = *__first.__seg_ & __m;
if (__b)
- return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
+ return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
}
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
-template <class _C>
-__bit_iterator<_C, false>
-__find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, _IsConst>
+__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, _IsConst> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
- __storage_type __dn = _STD::min(__clz_f, __n);
+ __storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
- __storage_type __b = ~(*__first.__seg_ & __m);
+ __storage_type __b = ~*__first.__seg_ & __m;
if (__b)
- return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
+ return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
+ if (__n == __dn)
+ return __first + __n;
__n -= __dn;
++__first.__seg_;
}
{
__storage_type __b = ~*__first.__seg_;
if (__b)
- return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
+ return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
}
// do last partial word
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __storage_type __b = ~(*__first.__seg_ & __m);
+ __storage_type __b = ~*__first.__seg_ & __m;
if (__b)
- return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
+ return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
}
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
-template <class _C, class _Tp>
+template <class _Cp, bool _IsConst, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
+__bit_iterator<_Cp, _IsConst>
+find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
{
- if (static_cast<bool>(__value))
- return __find_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
- return __find_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
+ if (static_cast<bool>(__value_))
+ return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
+ return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
}
// count
-template <class _C>
-typename __bit_iterator<_C, false>::difference_type
-__count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+template <class _Cp, bool _IsConst>
+typename __bit_iterator<_Cp, _IsConst>::difference_type
+__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, _IsConst> _It;
typedef typename _It::__storage_type __storage_type;
typedef typename _It::difference_type difference_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
- __storage_type __dn = _STD::min(__clz_f, __n);
+ __storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
- __r = _STD::__pop_count(*__first.__seg_ & __m);
+ __r = _VSTD::__pop_count(*__first.__seg_ & __m);
__n -= __dn;
++__first.__seg_;
}
// do middle whole words
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
- __r += _STD::__pop_count(*__first.__seg_);
+ __r += _VSTD::__pop_count(*__first.__seg_);
// do last partial word
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __r += _STD::__pop_count(*__first.__seg_ & __m);
+ __r += _VSTD::__pop_count(*__first.__seg_ & __m);
}
return __r;
}
-template <class _C>
-typename __bit_iterator<_C, false>::difference_type
-__count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+template <class _Cp, bool _IsConst>
+typename __bit_iterator<_Cp, _IsConst>::difference_type
+__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, _IsConst> _It;
typedef typename _It::__storage_type __storage_type;
typedef typename _It::difference_type difference_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
- __storage_type __dn = _STD::min(__clz_f, __n);
+ __storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
- __r = _STD::__pop_count(~(*__first.__seg_ & __m));
+ __r = _VSTD::__pop_count(~*__first.__seg_ & __m);
__n -= __dn;
++__first.__seg_;
}
// do middle whole words
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
- __r += _STD::__pop_count(~*__first.__seg_);
+ __r += _VSTD::__pop_count(~*__first.__seg_);
// do last partial word
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __r += _STD::__pop_count(~(*__first.__seg_ & __m));
+ __r += _VSTD::__pop_count(~*__first.__seg_ & __m);
}
return __r;
}
-template <class _C, class _Tp>
+template <class _Cp, bool _IsConst, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-typename __bit_iterator<_C, false>::difference_type
-count(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
+typename __bit_iterator<_Cp, _IsConst>::difference_type
+count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
{
- if (static_cast<bool>(__value))
- return __count_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
- return __count_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
+ if (static_cast<bool>(__value_))
+ return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
+ return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
}
// fill_n
-template <class _C>
+template <class _Cp>
void
-__fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
- __storage_type __dn = _STD::min(__clz_f, __n);
+ __storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
*__first.__seg_ &= ~__m;
__n -= __dn;
}
// do middle whole words
__storage_type __nw = __n / __bits_per_word;
- _STD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
+ _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last partial word
if (__n > 0)
}
}
-template <class _C>
+template <class _Cp>
void
-__fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
- __storage_type __dn = _STD::min(__clz_f, __n);
+ __storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
*__first.__seg_ |= __m;
__n -= __dn;
}
// do middle whole words
__storage_type __nw = __n / __bits_per_word;
- _STD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
+ _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last partial word
if (__n > 0)
}
}
-template <class _C>
-_LIBCPP_INLINE_VISIBILITY inline
+template <class _Cp>
+inline _LIBCPP_INLINE_VISIBILITY
void
-fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value)
+fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_)
{
if (__n > 0)
{
- if (__value)
+ if (__value_)
__fill_n_true(__first, __n);
else
__fill_n_false(__first, __n);
// fill
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
void
-fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value)
+fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_)
{
- _STD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
+ _VSTD::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_);
}
// copy
-template <class _C, bool _IsConst>
-__bit_iterator<_C, false>
-__copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
- __bit_iterator<_C, false> __result)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+ __bit_iterator<_Cp, false> __result)
{
- typedef __bit_iterator<_C, _IsConst> _In;
+ typedef __bit_iterator<_Cp, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
if (__first.__ctz_ != 0)
{
unsigned __clz = __bits_per_word - __first.__ctz_;
- difference_type __dn = _STD::min(static_cast<difference_type>(__clz), __n);
+ difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
__storage_type __b = *__first.__seg_ & __m;
// __first.__ctz_ == 0;
// do middle words
__storage_type __nw = __n / __bits_per_word;
- _STD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type));
+ _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
+ _VSTD::__to_raw_pointer(__first.__seg_),
+ __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
__result.__seg_ += __nw;
// do last word
return __result;
}
-template <class _C, bool _IsConst>
-__bit_iterator<_C, false>
-__copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
- __bit_iterator<_C, false> __result)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+ __bit_iterator<_Cp, false> __result)
{
- typedef __bit_iterator<_C, _IsConst> _In;
+ typedef __bit_iterator<_Cp, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
if (__first.__ctz_ != 0)
{
unsigned __clz_f = __bits_per_word - __first.__ctz_;
- difference_type __dn = _STD::min(static_cast<difference_type>(__clz_f), __n);
+ difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b = *__first.__seg_ & __m;
unsigned __clz_r = __bits_per_word - __result.__ctz_;
- __storage_type __ddn = _STD::min<__storage_type>(__dn, __clz_r);
+ __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
*__result.__seg_ &= ~__m;
if (__result.__ctz_ > __first.__ctz_)
{
__m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b = *__first.__seg_ & __m;
- __storage_type __dn = _STD::min(__n, static_cast<difference_type>(__clz_r));
+ __storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__clz_r));
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
*__result.__seg_ &= ~__m;
*__result.__seg_ |= __b << __result.__ctz_;
return __result;
}
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
+__bit_iterator<_Cp, false>
+copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
{
if (__first.__ctz_ == __result.__ctz_)
return __copy_aligned(__first, __last, __result);
// copy_backward
-template <class _C, bool _IsConst>
-__bit_iterator<_C, false>
-__copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
- __bit_iterator<_C, false> __result)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+ __bit_iterator<_Cp, false> __result)
{
- typedef __bit_iterator<_C, _IsConst> _In;
+ typedef __bit_iterator<_Cp, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
// do first word
if (__last.__ctz_ != 0)
{
- difference_type __dn = _STD::min(static_cast<difference_type>(__last.__ctz_), __n);
+ difference_type __dn = _VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
__n -= __dn;
unsigned __clz = __bits_per_word - __last.__ctz_;
__storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz);
__storage_type __nw = __n / __bits_per_word;
__result.__seg_ -= __nw;
__last.__seg_ -= __nw;
- _STD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type));
+ _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
+ _VSTD::__to_raw_pointer(__last.__seg_),
+ __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last word
if (__n > 0)
return __result;
}
-template <class _C, bool _IsConst>
-__bit_iterator<_C, false>
-__copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
- __bit_iterator<_C, false> __result)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+ __bit_iterator<_Cp, false> __result)
{
- typedef __bit_iterator<_C, _IsConst> _In;
+ typedef __bit_iterator<_Cp, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
// do first word
if (__last.__ctz_ != 0)
{
- difference_type __dn = _STD::min(static_cast<difference_type>(__last.__ctz_), __n);
+ difference_type __dn = _VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
__n -= __dn;
unsigned __clz_l = __bits_per_word - __last.__ctz_;
__storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_l);
__storage_type __b = *__last.__seg_ & __m;
unsigned __clz_r = __bits_per_word - __result.__ctz_;
- __storage_type __ddn = _STD::min(__dn, static_cast<difference_type>(__result.__ctz_));
+ __storage_type __ddn = _VSTD::min(__dn, static_cast<difference_type>(__result.__ctz_));
if (__ddn > 0)
{
__m = (~__storage_type(0) << (__result.__ctz_ - __ddn)) & (~__storage_type(0) >> __clz_r);
{
__m = ~__storage_type(0) << (__bits_per_word - __n);
__storage_type __b = *--__last.__seg_ & __m;
- unsigned __clz_r = __bits_per_word - __result.__ctz_;
- __storage_type __dn = _STD::min(__n, static_cast<difference_type>(__result.__ctz_));
+ __clz_r = __bits_per_word - __result.__ctz_;
+ __storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
*__result.__seg_ &= ~__m;
*__result.__seg_ |= __b >> (__bits_per_word - __result.__ctz_);
return __result;
}
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
+__bit_iterator<_Cp, false>
+copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
{
if (__last.__ctz_ == __result.__ctz_)
return __copy_backward_aligned(__first, __last, __result);
// move
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
+__bit_iterator<_Cp, false>
+move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
{
- return _STD::copy(__first, __last, __result);
+ return _VSTD::copy(__first, __last, __result);
}
// move_backward
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
+__bit_iterator<_Cp, false>
+move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
{
- return _STD::copy(__first, __last, __result);
+ return _VSTD::copy(__first, __last, __result);
}
// swap_ranges
-template <class _C1, class _C2>
-__bit_iterator<_C2, false>
-__swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
- __bit_iterator<_C2, false> __result)
+template <class __C1, class __C2>
+__bit_iterator<__C2, false>
+__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
+ __bit_iterator<__C2, false> __result)
{
- typedef __bit_iterator<_C1, false> _I1;
+ typedef __bit_iterator<__C1, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
if (__first.__ctz_ != 0)
{
unsigned __clz = __bits_per_word - __first.__ctz_;
- difference_type __dn = _STD::min(static_cast<difference_type>(__clz), __n);
+ difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
__storage_type __b1 = *__first.__seg_ & __m;
return __result;
}
-template <class _C1, class _C2>
-__bit_iterator<_C2, false>
-__swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
- __bit_iterator<_C2, false> __result)
+template <class __C1, class __C2>
+__bit_iterator<__C2, false>
+__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
+ __bit_iterator<__C2, false> __result)
{
- typedef __bit_iterator<_C1, false> _I1;
+ typedef __bit_iterator<__C1, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
if (__first.__ctz_ != 0)
{
unsigned __clz_f = __bits_per_word - __first.__ctz_;
- difference_type __dn = _STD::min(static_cast<difference_type>(__clz_f), __n);
+ difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b1 = *__first.__seg_ & __m;
*__first.__seg_ &= ~__m;
unsigned __clz_r = __bits_per_word - __result.__ctz_;
- __storage_type __ddn = _STD::min<__storage_type>(__dn, __clz_r);
+ __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
__storage_type __b2 = *__result.__seg_ & __m;
*__result.__seg_ &= ~__m;
__m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b1 = *__first.__seg_ & __m;
*__first.__seg_ &= ~__m;
- __storage_type __dn = _STD::min<__storage_type>(__n, __clz_r);
+ __storage_type __dn = _VSTD::min<__storage_type>(__n, __clz_r);
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
__storage_type __b2 = *__result.__seg_ & __m;
*__result.__seg_ &= ~__m;
return __result;
}
-template <class _C1, class _C2>
+template <class __C1, class __C2>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C2, false>
-swap_ranges(__bit_iterator<_C1, false> __first1, __bit_iterator<_C1, false> __last1,
- __bit_iterator<_C2, false> __first2)
+__bit_iterator<__C2, false>
+swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1,
+ __bit_iterator<__C2, false> __first2)
{
if (__first1.__ctz_ == __first2.__ctz_)
return __swap_ranges_aligned(__first1, __last1, __first2);
// rotate
-template <class _C>
+template <class _Cp>
struct __bit_array
{
- typedef typename _C::difference_type difference_type;
- typedef typename _C::__storage_type __storage_type;
- typedef typename _C::iterator iterator;
- static const unsigned __bits_per_word = _C::__bits_per_word;
- static const unsigned _N = 4;
+ typedef typename _Cp::difference_type difference_type;
+ typedef typename _Cp::__storage_type __storage_type;
+ typedef typename _Cp::__storage_pointer __storage_pointer;
+ typedef typename _Cp::iterator iterator;
+ static const unsigned __bits_per_word = _Cp::__bits_per_word;
+ static const unsigned _Np = 4;
difference_type __size_;
- __storage_type __word_[_N];
+ __storage_type __word_[_Np];
_LIBCPP_INLINE_VISIBILITY static difference_type capacity()
- {return static_cast<difference_type>(_N * __bits_per_word);}
+ {return static_cast<difference_type>(_Np * __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
- _LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);}
- _LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word,
- static_cast<unsigned>(__size_ % __bits_per_word));}
+ _LIBCPP_INLINE_VISIBILITY iterator begin()
+ {
+ return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0);
+ }
+ _LIBCPP_INLINE_VISIBILITY iterator end()
+ {
+ return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word,
+ static_cast<unsigned>(__size_ % __bits_per_word));
+ }
};
-template <class _C>
-__bit_iterator<_C, false>
-rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __bit_iterator<_C, false> __last)
+template <class _Cp>
+__bit_iterator<_Cp, false>
+rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last)
{
- typedef __bit_iterator<_C, false> _I1;
+ typedef __bit_iterator<_Cp, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
- static const unsigned __bits_per_word = _I1::__bits_per_word;
difference_type __d1 = __middle - __first;
difference_type __d2 = __last - __middle;
_I1 __r = __first + __d2;
{
if (__d1 <= __d2)
{
- if (__d1 <= __bit_array<_C>::capacity())
+ if (__d1 <= __bit_array<_Cp>::capacity())
{
- __bit_array<_C> __b(__d1);
- _STD::copy(__first, __middle, __b.begin());
- _STD::copy(__b.begin(), __b.end(), _STD::copy(__middle, __last, __first));
+ __bit_array<_Cp> __b(__d1);
+ _VSTD::copy(__first, __middle, __b.begin());
+ _VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
break;
}
else
{
- __bit_iterator<_C, false> __mp = _STD::swap_ranges(__first, __middle, __middle);
+ __bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
__first = __middle;
__middle = __mp;
__d2 -= __d1;
}
else
{
- if (__d2 <= __bit_array<_C>::capacity())
+ if (__d2 <= __bit_array<_Cp>::capacity())
{
- __bit_array<_C> __b(__d2);
- _STD::copy(__middle, __last, __b.begin());
- _STD::copy_backward(__b.begin(), __b.end(), _STD::copy_backward(__first, __middle, __last));
+ __bit_array<_Cp> __b(__d2);
+ _VSTD::copy(__middle, __last, __b.begin());
+ _VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
break;
}
else
{
- __bit_iterator<_C, false> __mp = __first + __d2;
- _STD::swap_ranges(__first, __mp, __middle);
+ __bit_iterator<_Cp, false> __mp = __first + __d2;
+ _VSTD::swap_ranges(__first, __mp, __middle);
__first = __mp;
__d1 -= __d2;
}
// equal
-template <class _C>
+template <class _Cp, bool _IC1, bool _IC2>
bool
-__equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
- __bit_iterator<_C, true> __first2)
+__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
+ __bit_iterator<_Cp, _IC2> __first2)
{
- typedef __bit_iterator<_C, true> _It;
+ typedef __bit_iterator<_Cp, _IC1> _It;
typedef typename _It::difference_type difference_type;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
if (__first1.__ctz_ != 0)
{
unsigned __clz_f = __bits_per_word - __first1.__ctz_;
- difference_type __dn = _STD::min(static_cast<difference_type>(__clz_f), __n);
+ difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b = *__first1.__seg_ & __m;
unsigned __clz_r = __bits_per_word - __first2.__ctz_;
- __storage_type __ddn = _STD::min<__storage_type>(__dn, __clz_r);
+ __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
if (__first2.__ctz_ > __first1.__ctz_)
+ {
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
return false;
+ }
else
+ {
if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
return false;
+ }
__first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
__first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
__dn -= __ddn;
{
__m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b = *__first1.__seg_ & __m;
- __storage_type __dn = _STD::min(__n, static_cast<difference_type>(__clz_r));
+ __storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__clz_r));
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_))
return false;
return true;
}
-template <class _C>
+template <class _Cp, bool _IC1, bool _IC2>
bool
-__equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
- __bit_iterator<_C, true> __first2)
+__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
+ __bit_iterator<_Cp, _IC2> __first2)
{
- typedef __bit_iterator<_C, true> _It;
+ typedef __bit_iterator<_Cp, _IC1> _It;
typedef typename _It::difference_type difference_type;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
if (__first1.__ctz_ != 0)
{
unsigned __clz = __bits_per_word - __first1.__ctz_;
- difference_type __dn = _STD::min(static_cast<difference_type>(__clz), __n);
+ difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m))
return true;
}
-template <class _C, bool _IC1, bool _IC2>
+template <class _Cp, 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)
+equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
{
if (__first1.__ctz_ == __first2.__ctz_)
return __equal_aligned(__first1, __last1, __first2);
return __equal_unaligned(__first1, __last1, __first2);
}
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst,
+ typename _Cp::__storage_type>
class __bit_iterator
{
public:
- typedef typename _C::difference_type difference_type;
+ typedef typename _Cp::difference_type difference_type;
typedef bool value_type;
typedef __bit_iterator pointer;
- typedef typename conditional<_IsConst, __bit_const_reference<_C>, __bit_reference<_C> >::type reference;
+ typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference;
typedef random_access_iterator_tag iterator_category;
private:
- typedef typename _C::__storage_type __storage_type;
- typedef typename conditional<_IsConst, typename _C::__const_storage_pointer,
- typename _C::__storage_pointer>::type __storage_pointer;
- static const unsigned __bits_per_word = _C::__bits_per_word;
+ typedef typename _Cp::__storage_type __storage_type;
+ typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer,
+ typename _Cp::__storage_pointer>::type __storage_pointer;
+ static const unsigned __bits_per_word = _Cp::__bits_per_word;
__storage_pointer __seg_;
unsigned __ctz_;
public:
- _LIBCPP_INLINE_VISIBILITY __bit_iterator() {}
+ _LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+ : __seg_(nullptr), __ctz_(0)
+#endif
+ {}
- _LIBCPP_INLINE_VISIBILITY __bit_iterator(const __bit_iterator<_C, false>& __it)
+ _LIBCPP_INLINE_VISIBILITY
+ __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
- _LIBCPP_INLINE_VISIBILITY reference operator*() const {return reference(__seg_, __storage_type(1) << __ctz_);}
+ _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
+ {return reference(__seg_, __storage_type(1) << __ctz_);}
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator++()
{
private:
_LIBCPP_INLINE_VISIBILITY
- __bit_iterator(__storage_pointer __s, unsigned __ctz) : __seg_(__s), __ctz_(__ctz) {}
+ __bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
+ : __seg_(__s), __ctz_(__ctz) {}
-#if defined(__clang__)
- friend typename _C::__self;
+#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
+ friend typename _Cp::__self;
#else
- friend class _C::__self;
+ friend class _Cp::__self;
#endif
- friend class __bit_reference<_C>;
- friend class __bit_const_reference<_C>;
- friend class __bit_iterator<_C, true>;
- template <class _D> friend struct __bit_array;
- template <class _D> friend void __fill_n_false(__bit_iterator<_D, false> __first, typename _D::size_type __n);
- template <class _D> friend void __fill_n_true(__bit_iterator<_D, false> __first, typename _D::size_type __n);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_aligned(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_unaligned(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> copy(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_aligned(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_unaligned(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_aligned(__bit_iterator<_C1, false>,
- __bit_iterator<_C1, false>,
- __bit_iterator<_C2, false>);
- template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_unaligned(__bit_iterator<_C1, false>,
- __bit_iterator<_C1, false>,
- __bit_iterator<_C2, false>);
- template <class _C1, class _C2>friend __bit_iterator<_C2, false> swap_ranges(__bit_iterator<_C1, false>,
- __bit_iterator<_C1, false>,
- __bit_iterator<_C2, false>);
- template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
- __bit_iterator<_D, false>,
- __bit_iterator<_D, false>);
- template <class _D> friend bool __equal_aligned(__bit_iterator<_D, true>,
- __bit_iterator<_D, true>,
- __bit_iterator<_D, true>);
- template <class _D> friend bool __equal_unaligned(__bit_iterator<_D, true>,
- __bit_iterator<_D, true>,
- __bit_iterator<_D, true>);
- template <class _D, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_D, _IC1>,
- __bit_iterator<_D, _IC1>,
- __bit_iterator<_D, _IC2>);
- template <class _D> friend __bit_iterator<_D, false> __find_bool_true(__bit_iterator<_D, false>,
- typename _D::size_type);
- template <class _D> friend __bit_iterator<_D, false> __find_bool_false(__bit_iterator<_D, false>,
- typename _D::size_type);
+ friend class __bit_reference<_Cp>;
+ friend class __bit_const_reference<_Cp>;
+ friend class __bit_iterator<_Cp, true>;
+ template <class _Dp> friend struct __bit_array;
+ template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
+ template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
+ __bit_iterator<__C1, false>,
+ __bit_iterator<__C2, false>);
+ template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>,
+ __bit_iterator<__C1, false>,
+ __bit_iterator<__C2, false>);
+ template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
+ __bit_iterator<__C1, false>,
+ __bit_iterator<__C2, false>);
+ template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>,
+ __bit_iterator<_Dp, false>,
+ __bit_iterator<_Dp, false>);
+ template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC2>);
+ template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC2>);
+ template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC2>);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>,
+ typename _Dp::size_type);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>,
+ typename _Dp::size_type);
+ template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
+ __count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
+ template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
+ __count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
};
_LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
+#if !defined(_MSC_VER) || defined(__clang__)
#pragma GCC system_header
+#endif
+
+#ifdef __k1om__
+#define __x86_64__ 1
+#endif
+
+
+#ifdef __GNUC__
+#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
+#endif
-#define _LIBCPP_VERSION 1000
+#define _LIBCPP_VERSION 1101
#define _LIBCPP_ABI_VERSION 1
// XXX: Global defs for Barrelfish: revisit for archs other than x86
#ifdef BARRELFISH
+# define __ISO_C_VISIBLE 1999
+# define _C99_SOURCE 1
+# define _GLIBCXX_USE_C99_DYNAMIC 1
# define __LITTLE_ENDIAN__ 1
# define LIBCPP_HAS_NO_UNICODE_CHARS
#endif
#endif // __BIG_ENDIAN__
#ifdef __FreeBSD__
+extern "C" {
# include <sys/endian.h>
+}
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
+# ifndef __LONG_LONG_SUPPORTED
+# define _LIBCPP_HAS_NO_LONG_LONG
+# endif // __LONG_LONG_SUPPORTED
#endif // __FreeBSD__
+#ifdef __NetBSD__
+extern "C" {
+# include <sys/endian.h>
+}
+# if _BYTE_ORDER == _LITTLE_ENDIAN
+# define _LIBCPP_LITTLE_ENDIAN 1
+# define _LIBCPP_BIG_ENDIAN 0
+# else // _BYTE_ORDER == _LITTLE_ENDIAN
+# define _LIBCPP_LITTLE_ENDIAN 0
+# define _LIBCPP_BIG_ENDIAN 1
+# endif // _BYTE_ORDER == _LITTLE_ENDIAN
+# define _LIBCPP_HAS_QUICK_EXIT
+#endif // __NetBSD__
+
+#ifdef __linux__
+# if defined(__GNUC__) && _GNUC_VER >= 403
+# define _LIBCPP_HAS_IS_BASE_OF
+# endif
+#endif
+
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
+extern "C" {
# include <endian.h>
+}
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
-#ifndef _LIBCPP_VISIBILITY_TAG
-#define _LIBCPP_VISIBILITY_TAG 1
+
+#ifndef __has_attribute
+#define __has_attribute(__x) 0
#endif
-#if _LIBCPP_VISIBILITY_TAG
+#ifndef _LIBCPP_HIDDEN
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
-#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
-#else // _LIBCPP_VISIBILITY_TAG
-#define _LIBCPP_HIDDEN
-#define _LIBCPP_VISIBLE
-#endif // _LIBCPP_VISIBILITY_TAG
+#endif
+
+#ifndef _LIBCPP_FUNC_VIS
+#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
+#endif
+
+#ifndef _LIBCPP_TYPE_VIS
+# if __has_attribute(__type_visibility__)
+# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
+# else
+# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
+# endif
+#endif
+
+#ifndef _LIBCPP_TYPE_VIS_ONLY
+# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
+#endif
+
+#ifndef _LIBCPP_FUNC_VIS_ONLY
+# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
+#endif
#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
#endif
-#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
-
+#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
+#endif
#if defined(__clang__)
-#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
+ !defined(__arm__)
+#define _LIBCPP_ALTERNATE_STRING_LAYOUT
+#endif
+
+#if __has_feature(cxx_alignas)
+# define _ALIGNAS_TYPE(x) alignas(x)
+# define _ALIGNAS(x) alignas(x)
+#else
+# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
+# define _ALIGNAS(x) __attribute__((__aligned__(x)))
+#endif
+
+#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#endif
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus < 201103L
#ifdef __linux__
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#else
#define _LIBCPP_NO_RTTI
#endif
+#if !(__has_feature(cxx_strong_enums))
+#define _LIBCPP_HAS_NO_STRONG_ENUMS
+#endif
+
#if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE
#endif
-#if !(__has_feature(cxx_attributes))
-#define _LIBCPP_HAS_NO_ATTRIBUTES
+#if __has_feature(cxx_attributes)
+# define _LIBCPP_NORETURN [[noreturn]]
+#else
+# define _LIBCPP_NORETURN __attribute__ ((noreturn))
#endif
+#if !(__has_feature(cxx_defaulted_functions))
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#endif // !(__has_feature(cxx_defaulted_functions))
#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_AUTO_TYPE
#endif
+#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
+#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#endif
+
#if !(__has_feature(cxx_variadic_templates))
#define _LIBCPP_HAS_NO_VARIADICS
#endif
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif
+#if !(__has_feature(cxx_generalized_initializers))
+#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif
+
+#if __has_feature(is_base_of)
+# define _LIBCPP_HAS_IS_BASE_OF
+#endif
+
+// Objective-C++ features (opt-in)
+#if __has_feature(objc_arc)
+#define _LIBCPP_HAS_OBJC_ARC
+#endif
+
+#if __has_feature(objc_arc_weak)
+#define _LIBCPP_HAS_OBJC_ARC_WEAK
+#define _LIBCPP_HAS_NO_STRONG_ENUMS
+#endif
+
+#ifdef __k1om__
+#define _LIBCPP_HAS_NO_CONSTEXPR
+#else
+#if !(__has_feature(cxx_constexpr))
+#define _LIBCPP_HAS_NO_CONSTEXPR
+#endif
+#endif
+
+#if !(__has_feature(cxx_relaxed_constexpr))
+#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+#endif
+
+#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
+#if defined(__FreeBSD__)
+#define _LIBCPP_HAS_QUICK_EXIT
+#define _LIBCPP_HAS_C11_FEATURES
+#elif defined(__ANDROID__)
+#define _LIBCPP_HAS_QUICK_EXIT
+#elif defined(__linux__)
+extern "C" {
+#include <features.h>
+}
+#if __GLIBC_PREREQ(2, 15)
+#define _LIBCPP_HAS_QUICK_EXIT
+#endif
+#if __GLIBC_PREREQ(2, 17)
+#define _LIBCPP_HAS_C11_FEATURES
+#endif
+#endif
+#endif
+
+#if (__has_feature(cxx_noexcept))
+# define _NOEXCEPT noexcept
+# define _NOEXCEPT_(x) noexcept(x)
+# define _NOEXCEPT_OR_FALSE(x) noexcept(x)
+#else
+# define _NOEXCEPT throw()
+# define _NOEXCEPT_(x)
+# define _NOEXCEPT_OR_FALSE(x) false
+#endif
+
+#if __has_feature(underlying_type)
+# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
+#endif
+
+#if __has_feature(is_literal)
+# define _LIBCPP_IS_LITERAL(T) __is_literal(T)
+#endif
+
// Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
-#define _STD std::_LIBCPP_NAMESPACE
+#define _VSTD std::_LIBCPP_NAMESPACE
namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
}
-#if !(__has_feature(cxx_constexpr))
-#define _LIBCPP_HAS_NO_CONSTEXPR
+#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
+#define _LIBCPP_HAS_NO_ASAN
#endif
-// end defined(__clang__)
-
#elif defined(__GNUC__)
+#define _ALIGNAS(x) __attribute__((__aligned__(x)))
+#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
+
+#define _LIBCPP_NORETURN __attribute__((noreturn))
+
+#if _GNUC_VER >= 407
+#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
+#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
+#endif
+
#if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
#endif
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+// constexpr was added to GCC in 4.6.
+#if _GNUC_VER < 406
#define _LIBCPP_HAS_NO_CONSTEXPR
+// Can only use constexpr in c++11 mode.
+#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
+#define _LIBCPP_HAS_NO_CONSTEXPR
+#endif
+
+// No version of GCC supports relaxed constexpr rules
+#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+
+#define _NOEXCEPT throw()
+#define _NOEXCEPT_(x)
+#define _NOEXCEPT_OR_FALSE(x) false
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+#define _LIBCPP_HAS_NO_STRONG_ENUMS
#else // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_TRAILING_RETURN
+#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
-#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
+#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
-#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
+#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
-#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
-#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_DECLTYPE
-#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
-#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
+#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _GNUC_VER < 404
-#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
-#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+#if _GNUC_VER < 406
#define _LIBCPP_HAS_NO_NULLPTR
#endif
+#if _GNUC_VER < 407
+#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#endif
+
#endif // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
-#define _STD std::_LIBCPP_NAMESPACE
+#define _VSTD std::_LIBCPP_NAMESPACE
namespace std {
namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
-#endif // defined(__GNUC__)
+#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
+#define _LIBCPP_HAS_NO_ASAN
+#endif
+
+#elif defined(_LIBCPP_MSVC)
+
+#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
+#define _LIBCPP_HAS_NO_CONSTEXPR
+#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+#define _LIBCPP_HAS_NO_UNICODE_CHARS
+#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define __alignof__ __alignof
+#define _LIBCPP_NORETURN __declspec(noreturn)
+#define _ALIGNAS(x) __declspec(align(x))
+#define _LIBCPP_HAS_NO_VARIADICS
+
+#define _NOEXCEPT throw ()
+#define _NOEXCEPT_(x)
+#define _NOEXCEPT_OR_FALSE(x) false
+
+#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
+#define _LIBCPP_END_NAMESPACE_STD }
+#define _VSTD std
+
+# define _LIBCPP_WEAK
+namespace std {
+}
+
+#define _LIBCPP_HAS_NO_ASAN
+
+#elif defined(__IBMCPP__)
+
+#define _ALIGNAS(x) __attribute__((__aligned__(x)))
+#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
+#define _ATTRIBUTE(x) __attribute__((x))
+#define _LIBCPP_NORETURN __attribute__((noreturn))
+
+#define _NOEXCEPT throw()
+#define _NOEXCEPT_(x)
+#define _NOEXCEPT_OR_FALSE(x) false
+
+#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#define _LIBCPP_HAS_NO_NULLPTR
+#define _LIBCPP_HAS_NO_UNICODE_CHARS
+#define _LIBCPP_HAS_IS_BASE_OF
+
+#if defined(_AIX)
+#define __MULTILOCALE_API
+#endif
+
+#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
+#define _LIBCPP_END_NAMESPACE_STD } }
+#define _VSTD std::_LIBCPP_NAMESPACE
+
+namespace std {
+ inline namespace _LIBCPP_NAMESPACE {
+ }
+}
+
+#define _LIBCPP_HAS_NO_ASAN
+
+#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
typedef unsigned int char32_t;
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+#ifndef __SIZEOF_INT128__
+#define _LIBCPP_HAS_NO_INT128
+#endif
+
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
template <bool> struct __static_assert_test;
#define decltype(x) __typeof__(x)
#endif
+#ifdef __k1om__
+#define _LIBCPP_CONSTEXPR
+#else
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
-#define constexpr const
+#define _LIBCPP_CONSTEXPR
+#else
+#define _LIBCPP_CONSTEXPR constexpr
+#endif
+#endif
+
+#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define _LIBCPP_DEFAULT {}
+#else
+#define _LIBCPP_DEFAULT = default;
+#endif
+
+#ifdef __GNUC__
+#define _NOALIAS __attribute__((__malloc__))
+#else
+#define _NOALIAS
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
+#ifndef __has_builtin
+#define __has_builtin(__x) 0
+#endif
+
+#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
+# define _LIBCPP_EXPLICIT explicit
+#else
+# define _LIBCPP_EXPLICIT
+#endif
+
+#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
+# define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
+#endif
+
+#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
+#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
+ __lx __v_; \
+ _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
+ _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
+ _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
+ };
+#else // _LIBCPP_HAS_NO_STRONG_ENUMS
+#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
+#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
+#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
+
+#ifdef _LIBCPP_DEBUG
+# if _LIBCPP_DEBUG == 0
+# define _LIBCPP_DEBUG_LEVEL 1
+# elif _LIBCPP_DEBUG == 1
+# define _LIBCPP_DEBUG_LEVEL 2
+# else
+# error Supported values for _LIBCPP_DEBUG are 0 and 1
+# endif
+# define _LIBCPP_EXTERN_TEMPLATE(...)
+#endif
+
+#ifndef _LIBCPP_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+#endif
+
+#ifndef _LIBCPP_EXTERN_TEMPLATE2
+#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
+#endif
+
+#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
+#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
+#endif
+
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
+#define _LIBCPP_LOCALE__L_EXTENSIONS 1
+#endif
+
+#ifdef __FreeBSD__
+#define _DECLARE_C99_LDBL_MATH 1
+#endif
+
+#if defined(__APPLE__) || defined(__FreeBSD__)
+#define _LIBCPP_HAS_DEFAULTRUNELOCALE
+#endif
+
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
+#define _LIBCPP_WCTYPE_IS_MASK
+#endif
+
+#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
+#endif
+
+#ifndef _LIBCPP_STD_VER
+# if __cplusplus <= 201103L
+# define _LIBCPP_STD_VER 11
+# elif __cplusplus <= 201402L
+# define _LIBCPP_STD_VER 14
+# else
+# define _LIBCPP_STD_VER 15 // current year, or date of c++17 ratification
+# endif
+#endif // _LIBCPP_STD_VER
+
+#if _LIBCPP_STD_VER > 11
+#define _LIBCPP_DEPRECATED [[deprecated]]
+#else
+#define _LIBCPP_DEPRECATED
+#endif
+
+#if _LIBCPP_STD_VER <= 11
+#define _LIBCPP_EXPLICIT_AFTER_CXX11
+#define _LIBCPP_DEPRECATED_AFTER_CXX11
+#else
+#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
+#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
+#endif
+
+#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
+#else
+#define _LIBCPP_CONSTEXPR_AFTER_CXX11
+#endif
+
+#ifndef _LIBCPP_HAS_NO_ASAN
+extern "C" void __sanitizer_annotate_contiguous_container(
+ const void *, const void *, const void *, const void *);
+#endif
+
+// Try to find out if RTTI is disabled.
+// g++ and cl.exe have RTTI on by default and define a macro when it is.
+// g++ only defines the macro in 4.3.2 and onwards.
+#if !defined(_LIBCPP_NO_RTTI)
+# if defined(__GNUG__) && (__GNUC__ >= 4 && \
+ (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2)) && !defined(__GXX_RTTI)
+# define _LIBCPP_NO_RTTI
+# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
+# define _LIBCPP_NO_RTTI
+# endif
+#endif
+
+#ifndef _LIBCPP_WEAK
+# define _LIBCPP_WEAK __attribute__((__weak__))
+#endif
+
#endif // _LIBCPP_CONFIG
--- /dev/null
+// -*- C++ -*-
+//===--------------------------- __debug ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_DEBUG_H
+#define _LIBCPP_DEBUG_H
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#if _LIBCPP_DEBUG_LEVEL >= 1
+
+# include <cstdlib>
+# include <cstdio>
+# include <cstddef>
+# ifndef _LIBCPP_ASSERT
+# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
+# endif
+
+#endif
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+struct _LIBCPP_TYPE_VIS __c_node;
+
+struct _LIBCPP_TYPE_VIS __i_node
+{
+ void* __i_;
+ __i_node* __next_;
+ __c_node* __c_;
+
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+ __i_node(const __i_node&) = delete;
+ __i_node& operator=(const __i_node&) = delete;
+#else
+private:
+ __i_node(const __i_node&);
+ __i_node& operator=(const __i_node&);
+public:
+#endif
+ _LIBCPP_INLINE_VISIBILITY
+ __i_node(void* __i, __i_node* __next, __c_node* __c)
+ : __i_(__i), __next_(__next), __c_(__c) {}
+ ~__i_node();
+};
+
+struct _LIBCPP_TYPE_VIS __c_node
+{
+ void* __c_;
+ __c_node* __next_;
+ __i_node** beg_;
+ __i_node** end_;
+ __i_node** cap_;
+
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+ __c_node(const __c_node&) = delete;
+ __c_node& operator=(const __c_node&) = delete;
+#else
+private:
+ __c_node(const __c_node&);
+ __c_node& operator=(const __c_node&);
+public:
+#endif
+ _LIBCPP_INLINE_VISIBILITY
+ __c_node(void* __c, __c_node* __next)
+ : __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
+ virtual ~__c_node();
+
+ virtual bool __dereferenceable(const void*) const = 0;
+ virtual bool __decrementable(const void*) const = 0;
+ virtual bool __addable(const void*, ptrdiff_t) const = 0;
+ virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
+
+ void __add(__i_node* __i);
+ _LIBCPP_HIDDEN void __remove(__i_node* __i);
+};
+
+template <class _Cont>
+struct _C_node
+ : public __c_node
+{
+ _C_node(void* __c, __c_node* __n)
+ : __c_node(__c, __n) {}
+
+ virtual bool __dereferenceable(const void*) const;
+ virtual bool __decrementable(const void*) const;
+ virtual bool __addable(const void*, ptrdiff_t) const;
+ virtual bool __subscriptable(const void*, ptrdiff_t) const;
+};
+
+template <class _Cont>
+bool
+_C_node<_Cont>::__dereferenceable(const void* __i) const
+{
+ typedef typename _Cont::const_iterator iterator;
+ const iterator* __j = static_cast<const iterator*>(__i);
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
+ return _Cp->__dereferenceable(__j);
+}
+
+template <class _Cont>
+bool
+_C_node<_Cont>::__decrementable(const void* __i) const
+{
+ typedef typename _Cont::const_iterator iterator;
+ const iterator* __j = static_cast<const iterator*>(__i);
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
+ return _Cp->__decrementable(__j);
+}
+
+template <class _Cont>
+bool
+_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
+{
+ typedef typename _Cont::const_iterator iterator;
+ const iterator* __j = static_cast<const iterator*>(__i);
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
+ return _Cp->__addable(__j, __n);
+}
+
+template <class _Cont>
+bool
+_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
+{
+ typedef typename _Cont::const_iterator iterator;
+ const iterator* __j = static_cast<const iterator*>(__i);
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
+ return _Cp->__subscriptable(__j, __n);
+}
+
+class _LIBCPP_TYPE_VIS __libcpp_db
+{
+ __c_node** __cbeg_;
+ __c_node** __cend_;
+ size_t __csz_;
+ __i_node** __ibeg_;
+ __i_node** __iend_;
+ size_t __isz_;
+
+ __libcpp_db();
+public:
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+ __libcpp_db(const __libcpp_db&) = delete;
+ __libcpp_db& operator=(const __libcpp_db&) = delete;
+#else
+private:
+ __libcpp_db(const __libcpp_db&);
+ __libcpp_db& operator=(const __libcpp_db&);
+public:
+#endif
+ ~__libcpp_db();
+
+ class __db_c_iterator;
+ class __db_c_const_iterator;
+ class __db_i_iterator;
+ class __db_i_const_iterator;
+
+ __db_c_const_iterator __c_end() const;
+ __db_i_const_iterator __i_end() const;
+
+ template <class _Cont>
+ _LIBCPP_INLINE_VISIBILITY
+ void __insert_c(_Cont* __c)
+ {
+ __c_node* __n = __insert_c(static_cast<void*>(__c));
+ ::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
+ }
+
+ void __insert_i(void* __i);
+ __c_node* __insert_c(void* __c);
+ void __erase_c(void* __c);
+
+ void __insert_ic(void* __i, const void* __c);
+ void __iterator_copy(void* __i, const void* __i0);
+ void __erase_i(void* __i);
+
+ void* __find_c_from_i(void* __i) const;
+ void __invalidate_all(void* __c);
+ __c_node* __find_c_and_lock(void* __c) const;
+ __c_node* __find_c(void* __c) const;
+ void unlock() const;
+
+ void swap(void* __c1, void* __c2);
+
+
+ bool __dereferenceable(const void* __i) const;
+ bool __decrementable(const void* __i) const;
+ bool __addable(const void* __i, ptrdiff_t __n) const;
+ bool __subscriptable(const void* __i, ptrdiff_t __n) const;
+ bool __less_than_comparable(const void* __i, const void* __j) const;
+private:
+ _LIBCPP_HIDDEN
+ __i_node* __insert_iterator(void* __i);
+ _LIBCPP_HIDDEN
+ __i_node* __find_iterator(const void* __i) const;
+
+ friend _LIBCPP_FUNC_VIS __libcpp_db* __get_db();
+};
+
+_LIBCPP_FUNC_VIS __libcpp_db* __get_db();
+_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
+
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif
+
+#endif // _LIBCPP_DEBUG_H
+
// manual variadic expansion for <functional>
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
+#endif
template <class _Tp>
class __mem_fn
// invoke
typename __invoke_return<type>::type
- operator() ()
+ operator() () const
{
return __invoke(__f_);
}
template <class _A0>
typename __invoke_return0<type, _A0>::type
- operator() (_A0& __a0)
+ operator() (_A0& __a0) const
{
return __invoke(__f_, __a0);
}
template <class _A0, class _A1>
typename __invoke_return1<type, _A0, _A1>::type
- operator() (_A0& __a0, _A1& __a1)
+ operator() (_A0& __a0, _A1& __a1) const
{
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1, class _A2>
typename __invoke_return2<type, _A0, _A1, _A2>::type
- operator() (_A0& __a0, _A1& __a1, _A2& __a2)
+ operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
{
return __invoke(__f_, __a0, __a1, __a2);
}
};
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R _T::*>
-mem_fn(_R _T::* __pm)
+__mem_fn<_Rp _Tp::*>
+mem_fn(_Rp _Tp::* __pm)
{
- return __mem_fn<_R _T::*>(__pm);
+ return __mem_fn<_Rp _Tp::*>(__pm);
}
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)()>
-mem_fn(_R (_T::* __pm)())
+__mem_fn<_Rp (_Tp::*)()>
+mem_fn(_Rp (_Tp::* __pm)())
{
- return __mem_fn<_R (_T::*)()>(__pm);
+ return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
-template<class _R, class _T, class _A0>
+template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0)>
-mem_fn(_R (_T::* __pm)(_A0))
+__mem_fn<_Rp (_Tp::*)(_A0)>
+mem_fn(_Rp (_Tp::* __pm)(_A0))
{
- return __mem_fn<_R (_T::*)(_A0)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1>
+template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1)>
-mem_fn(_R (_T::* __pm)(_A0, _A1))
+__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1))
{
- return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1, class _A2>
+template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1, _A2)>
-mem_fn(_R (_T::* __pm)(_A0, _A1, _A2))
+__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2))
{
- return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)()>
-mem_fn(_R (_T::* __pm)() const)
+__mem_fn<_Rp (_Tp::*)() const>
+mem_fn(_Rp (_Tp::* __pm)() const)
{
- return __mem_fn<_R (_T::*)()>(__pm);
+ return __mem_fn<_Rp (_Tp::*)() const>(__pm);
}
-template<class _R, class _T, class _A0>
+template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0)>
-mem_fn(_R (_T::* __pm)(_A0) const)
+__mem_fn<_Rp (_Tp::*)(_A0) const>
+mem_fn(_Rp (_Tp::* __pm)(_A0) const)
{
- return __mem_fn<_R (_T::*)(_A0)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0) const>(__pm);
}
-template<class _R, class _T, class _A0, class _A1>
+template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1)>
-mem_fn(_R (_T::* __pm)(_A0, _A1) const)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1) const>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const)
{
- return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const>(__pm);
}
-template<class _R, class _T, class _A0, class _A1, class _A2>
+template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1, _A2)>
-mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) const)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const)
{
- return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>(__pm);
}
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)()>
-mem_fn(_R (_T::* __pm)() volatile)
+__mem_fn<_Rp (_Tp::*)() volatile>
+mem_fn(_Rp (_Tp::* __pm)() volatile)
{
- return __mem_fn<_R (_T::*)()>(__pm);
+ return __mem_fn<_Rp (_Tp::*)() volatile>(__pm);
}
-template<class _R, class _T, class _A0>
+template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0)>
-mem_fn(_R (_T::* __pm)(_A0) volatile)
+__mem_fn<_Rp (_Tp::*)(_A0) volatile>
+mem_fn(_Rp (_Tp::* __pm)(_A0) volatile)
{
- return __mem_fn<_R (_T::*)(_A0)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0) volatile>(__pm);
}
-template<class _R, class _T, class _A0, class _A1>
+template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1)>
-mem_fn(_R (_T::* __pm)(_A0, _A1) volatile)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile)
{
- return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>(__pm);
}
-template<class _R, class _T, class _A0, class _A1, class _A2>
+template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1, _A2)>
-mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) volatile)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile)
{
- return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>(__pm);
}
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)()>
-mem_fn(_R (_T::* __pm)() const volatile)
+__mem_fn<_Rp (_Tp::*)() const volatile>
+mem_fn(_Rp (_Tp::* __pm)() const volatile)
{
- return __mem_fn<_R (_T::*)()>(__pm);
+ return __mem_fn<_Rp (_Tp::*)() const volatile>(__pm);
}
-template<class _R, class _T, class _A0>
+template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0)>
-mem_fn(_R (_T::* __pm)(_A0) const volatile)
+__mem_fn<_Rp (_Tp::*)(_A0) const volatile>
+mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile)
{
- return __mem_fn<_R (_T::*)(_A0)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0) const volatile>(__pm);
}
-template<class _R, class _T, class _A0, class _A1>
+template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1)>
-mem_fn(_R (_T::* __pm)(_A0, _A1) const volatile)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile)
{
- return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>(__pm);
}
-template<class _R, class _T, class _A0, class _A1, class _A2>
+template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1, _A2)>
-mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) const volatile)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile)
{
- return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>(__pm);
}
// bad_function_call
{
};
-template<class _Fp> class _LIBCPP_VISIBLE function; // undefined
+template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
namespace __function
{
-template<class _F>
+template<class _Fp>
struct __maybe_derive_from_unary_function
{
};
-template<class _R, class _A1>
-struct __maybe_derive_from_unary_function<_R(_A1)>
- : public unary_function<_A1, _R>
+template<class _Rp, class _A1>
+struct __maybe_derive_from_unary_function<_Rp(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template<class _F>
+template<class _Fp>
struct __maybe_derive_from_binary_function
{
};
-template<class _R, class _A1, class _A2>
-struct __maybe_derive_from_binary_function<_R(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template<class _Rp, class _A1, class _A2>
+struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
template<class _Fp> class __base;
-template<class _R>
-class __base<_R()>
+template<class _Rp>
+class __base<_Rp()>
{
__base(const __base&);
__base& operator=(const __base&);
virtual void __clone(__base*) const = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
- virtual _R operator()() = 0;
+ virtual _Rp operator()() = 0;
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const = 0;
virtual const std::type_info& target_type() const = 0;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0>
-class __base<_R(_A0)>
+template<class _Rp, class _A0>
+class __base<_Rp(_A0)>
{
__base(const __base&);
__base& operator=(const __base&);
virtual void __clone(__base*) const = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
- virtual _R operator()(_A0) = 0;
+ virtual _Rp operator()(_A0) = 0;
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const = 0;
virtual const std::type_info& target_type() const = 0;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0, class _A1>
-class __base<_R(_A0, _A1)>
+template<class _Rp, class _A0, class _A1>
+class __base<_Rp(_A0, _A1)>
{
__base(const __base&);
__base& operator=(const __base&);
virtual void __clone(__base*) const = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
- virtual _R operator()(_A0, _A1) = 0;
+ virtual _Rp operator()(_A0, _A1) = 0;
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const = 0;
virtual const std::type_info& target_type() const = 0;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0, class _A1, class _A2>
-class __base<_R(_A0, _A1, _A2)>
+template<class _Rp, class _A0, class _A1, class _A2>
+class __base<_Rp(_A0, _A1, _A2)>
{
__base(const __base&);
__base& operator=(const __base&);
virtual void __clone(__base*) const = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
- virtual _R operator()(_A0, _A1, _A2) = 0;
+ virtual _Rp operator()(_A0, _A1, _A2) = 0;
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const = 0;
virtual const std::type_info& target_type() const = 0;
template<class _FD, class _Alloc, class _FB> class __func;
-template<class _F, class _Alloc, class _R>
-class __func<_F, _Alloc, _R()>
- : public __base<_R()>
+template<class _Fp, class _Alloc, class _Rp>
+class __func<_Fp, _Alloc, _Rp()>
+ : public __base<_Rp()>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
- explicit __func(_F __f) : __f_(_STD::move(__f)) {}
- explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
- virtual __base<_R()>* __clone() const;
- virtual void __clone(__base<_R()>*) const;
+ explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+ explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
+ virtual __base<_Rp()>* __clone() const;
+ virtual void __clone(__base<_Rp()>*) const;
virtual void destroy();
virtual void destroy_deallocate();
- virtual _R operator()();
+ virtual _Rp operator()();
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const;
virtual const std::type_info& target_type() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _F, class _Alloc, class _R>
-__base<_R()>*
-__func<_F, _Alloc, _R()>::__clone() const
+template<class _Fp, class _Alloc, class _Rp>
+__base<_Rp()>*
+__func<_Fp, _Alloc, _Rp()>::__clone() const
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1));
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
return __hold.release();
}
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
void
-__func<_F, _Alloc, _R()>::__clone(__base<_R()>* __p) const
+__func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const
{
::new (__p) __func(__f_.first(), __f_.second());
}
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
void
-__func<_F, _Alloc, _R()>::destroy()
+__func<_Fp, _Alloc, _Rp()>::destroy()
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
void
-__func<_F, _Alloc, _R()>::destroy_deallocate()
+__func<_Fp, _Alloc, _Rp()>::destroy_deallocate()
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R>
-_R
-__func<_F, _Alloc, _R()>::operator()()
+template<class _Fp, class _Alloc, class _Rp>
+_Rp
+__func<_Fp, _Alloc, _Rp()>::operator()()
{
return __invoke(__f_.first());
}
#ifndef _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
const void*
-__func<_F, _Alloc, _R()>::target(const type_info& __ti) const
+__func<_Fp, _Alloc, _Rp()>::target(const type_info& __ti) const
{
- if (__ti == typeid(_F))
+ if (__ti == typeid(_Fp))
return &__f_.first();
return (const void*)0;
}
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
const std::type_info&
-__func<_F, _Alloc, _R()>::target_type() const
+__func<_Fp, _Alloc, _Rp()>::target_type() const
{
- return typeid(_F);
+ return typeid(_Fp);
}
#endif // _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0>
-class __func<_F, _Alloc, _R(_A0)>
- : public __base<_R(_A0)>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+class __func<_Fp, _Alloc, _Rp(_A0)>
+ : public __base<_Rp(_A0)>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
- : __f_(_STD::move(__f), _STD::move(__a)) {}
- virtual __base<_R(_A0)>* __clone() const;
- virtual void __clone(__base<_R(_A0)>*) const;
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
+ : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
+ virtual __base<_Rp(_A0)>* __clone() const;
+ virtual void __clone(__base<_Rp(_A0)>*) const;
virtual void destroy();
virtual void destroy_deallocate();
- virtual _R operator()(_A0);
+ virtual _Rp operator()(_A0);
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const;
virtual const std::type_info& target_type() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _F, class _Alloc, class _R, class _A0>
-__base<_R(_A0)>*
-__func<_F, _Alloc, _R(_A0)>::__clone() const
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+__base<_Rp(_A0)>*
+__func<_Fp, _Alloc, _Rp(_A0)>::__clone() const
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1));
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
return __hold.release();
}
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
void
-__func<_F, _Alloc, _R(_A0)>::__clone(__base<_R(_A0)>* __p) const
+__func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const
{
::new (__p) __func(__f_.first(), __f_.second());
}
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
void
-__func<_F, _Alloc, _R(_A0)>::destroy()
+__func<_Fp, _Alloc, _Rp(_A0)>::destroy()
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
void
-__func<_F, _Alloc, _R(_A0)>::destroy_deallocate()
+__func<_Fp, _Alloc, _Rp(_A0)>::destroy_deallocate()
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R, class _A0>
-_R
-__func<_F, _Alloc, _R(_A0)>::operator()(_A0 __a0)
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+_Rp
+__func<_Fp, _Alloc, _Rp(_A0)>::operator()(_A0 __a0)
{
return __invoke(__f_.first(), __a0);
}
#ifndef _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
const void*
-__func<_F, _Alloc, _R(_A0)>::target(const type_info& __ti) const
+__func<_Fp, _Alloc, _Rp(_A0)>::target(const type_info& __ti) const
{
- if (__ti == typeid(_F))
+ if (__ti == typeid(_Fp))
return &__f_.first();
return (const void*)0;
}
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
const std::type_info&
-__func<_F, _Alloc, _R(_A0)>::target_type() const
+__func<_Fp, _Alloc, _Rp(_A0)>::target_type() const
{
- return typeid(_F);
+ return typeid(_Fp);
}
#endif // _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
-class __func<_F, _Alloc, _R(_A0, _A1)>
- : public __base<_R(_A0, _A1)>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+class __func<_Fp, _Alloc, _Rp(_A0, _A1)>
+ : public __base<_Rp(_A0, _A1)>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
- : __f_(_STD::move(__f), _STD::move(__a)) {}
- virtual __base<_R(_A0, _A1)>* __clone() const;
- virtual void __clone(__base<_R(_A0, _A1)>*) const;
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
+ : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
+ virtual __base<_Rp(_A0, _A1)>* __clone() const;
+ virtual void __clone(__base<_Rp(_A0, _A1)>*) const;
virtual void destroy();
virtual void destroy_deallocate();
- virtual _R operator()(_A0, _A1);
+ virtual _Rp operator()(_A0, _A1);
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const;
virtual const std::type_info& target_type() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
-__base<_R(_A0, _A1)>*
-__func<_F, _Alloc, _R(_A0, _A1)>::__clone() const
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+__base<_Rp(_A0, _A1)>*
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1));
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
return __hold.release();
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
void
-__func<_F, _Alloc, _R(_A0, _A1)>::__clone(__base<_R(_A0, _A1)>* __p) const
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const
{
::new (__p) __func(__f_.first(), __f_.second());
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
void
-__func<_F, _Alloc, _R(_A0, _A1)>::destroy()
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy()
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
void
-__func<_F, _Alloc, _R(_A0, _A1)>::destroy_deallocate()
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy_deallocate()
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
-_R
-__func<_F, _Alloc, _R(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1)
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+_Rp
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1)
{
return __invoke(__f_.first(), __a0, __a1);
}
#ifndef _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
const void*
-__func<_F, _Alloc, _R(_A0, _A1)>::target(const type_info& __ti) const
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target(const type_info& __ti) const
{
- if (__ti == typeid(_F))
+ if (__ti == typeid(_Fp))
return &__f_.first();
return (const void*)0;
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
const std::type_info&
-__func<_F, _Alloc, _R(_A0, _A1)>::target_type() const
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target_type() const
{
- return typeid(_F);
+ return typeid(_Fp);
}
#endif // _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
-class __func<_F, _Alloc, _R(_A0, _A1, _A2)>
- : public __base<_R(_A0, _A1, _A2)>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>
+ : public __base<_Rp(_A0, _A1, _A2)>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
- : __f_(_STD::move(__f), _STD::move(__a)) {}
- virtual __base<_R(_A0, _A1, _A2)>* __clone() const;
- virtual void __clone(__base<_R(_A0, _A1, _A2)>*) const;
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
+ : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
+ virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const;
+ virtual void __clone(__base<_Rp(_A0, _A1, _A2)>*) const;
virtual void destroy();
virtual void destroy_deallocate();
- virtual _R operator()(_A0, _A1, _A2);
+ virtual _Rp operator()(_A0, _A1, _A2);
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const;
virtual const std::type_info& target_type() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
-__base<_R(_A0, _A1, _A2)>*
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::__clone() const
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+__base<_Rp(_A0, _A1, _A2)>*
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1));
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
return __hold.release();
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
void
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::__clone(__base<_R(_A0, _A1, _A2)>* __p) const
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const
{
::new (__p) __func(__f_.first(), __f_.second());
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
void
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::destroy()
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy()
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
void
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::destroy_deallocate()
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy_deallocate()
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
-_R
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2)
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+_Rp
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2)
{
return __invoke(__f_.first(), __a0, __a1, __a2);
}
#ifndef _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
const void*
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::target(const type_info& __ti) const
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target(const type_info& __ti) const
{
- if (__ti == typeid(_F))
+ if (__ti == typeid(_Fp))
return &__f_.first();
return (const void*)0;
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
const std::type_info&
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::target_type() const
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target_type() const
{
- return typeid(_F);
+ return typeid(_Fp);
}
#endif // _LIBCPP_NO_RTTI
} // __function
-template<class _R>
-class _LIBCPP_VISIBLE function<_R()>
+template<class _Rp>
+class _LIBCPP_TYPE_VIS_ONLY function<_Rp()>
{
- typedef __function::__base<_R()> __base;
+ typedef __function::__base<_Rp()> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _F>
- static bool __not_null(const _F&) {return true;}
+ template <class _Fp>
+ _LIBCPP_INLINE_VISIBILITY
+ static bool __not_null(const _Fp&) {return true;}
template <class _R2>
- static bool __not_null(const function<_R()>& __p) {return __p;}
+ _LIBCPP_INLINE_VISIBILITY
+ static bool __not_null(_R2 (*__p)()) {return __p;}
+ template <class _R2>
+ _LIBCPP_INLINE_VISIBILITY
+ static bool __not_null(const function<_R2()>& __p) {return __p;}
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// 20.7.16.2.1, construct/copy/destroy:
_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 _Fp>
+ function(_Fp,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 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&);
- template<class _F, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _F __f,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp, class _Alloc>
+ function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
function& operator=(const function&);
function& operator=(nullptr_t);
- template<class _F>
+ template<class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
+ !is_integral<_Fp>::value,
function&
>::type
- operator=(_F);
+ operator=(_Fp);
~function();
// 20.7.16.2.2, function modifiers:
void swap(function&);
- template<class _F, class _Alloc>
+ template<class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- void assign(_F __f, const _Alloc& __a)
+ void assign(_Fp __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
bool operator!=(const function<_R2()>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
- _R operator()() const;
+ _Rp operator()() const;
#ifndef _LIBCPP_NO_RTTI
// 20.7.16.2.5, function target access:
const std::type_info& target_type() const;
- template <typename _T> _T* target();
- template <typename _T> const _T* target() const;
+ template <typename _Tp> _Tp* target();
+ template <typename _Tp> const _Tp* target() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R>
-function<_R()>::function(const function& __f)
+template<class _Rp>
+function<_Rp()>::function(const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
__f_ = __f.__f_->__clone();
}
-template<class _R>
+template<class _Rp>
template<class _Alloc>
-function<_R()>::function(allocator_arg_t, const _Alloc&, const function& __f)
+function<_Rp()>::function(allocator_arg_t, const _Alloc&, const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
__f_ = __f.__f_->__clone();
}
-template<class _R>
-template <class _F>
-function<_R()>::function(_F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp>
+template <class _Fp>
+function<_Rp()>::function(_Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
{
- typedef __function::__func<_F, allocator<_F>, _R()> _FF;
+ typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(__f, allocator<_F>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
__f_ = __hold.release();
}
}
}
-template<class _R>
-template <class _F, class _Alloc>
-function<_R()>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp>
+template <class _Fp, class _Alloc>
+function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
{
- typedef __function::__func<_F, _Alloc, _R()> _FF;
+ typedef __function::__func<_Fp, _Alloc, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(__f, _Alloc(__a));
__f_ = __hold.release();
}
}
}
-template<class _R>
-function<_R()>&
-function<_R()>::operator=(const function& __f)
+template<class _Rp>
+function<_Rp()>&
+function<_Rp()>::operator=(const function& __f)
{
function(__f).swap(*this);
return *this;
}
-template<class _R>
-function<_R()>&
-function<_R()>::operator=(nullptr_t)
+template<class _Rp>
+function<_Rp()>&
+function<_Rp()>::operator=(nullptr_t)
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
__f_ = 0;
}
-template<class _R>
-template <class _F>
+template<class _Rp>
+template <class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
- function<_R()>&
+ !is_integral<_Fp>::value,
+ function<_Rp()>&
>::type
-function<_R()>::operator=(_F __f)
+function<_Rp()>::operator=(_Fp __f)
{
- function(_STD::move(__f)).swap(*this);
+ function(_VSTD::move(__f)).swap(*this);
return *this;
}
-template<class _R>
-function<_R()>::~function()
+template<class _Rp>
+function<_Rp()>::~function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
__f_->destroy_deallocate();
}
-template<class _R>
+template<class _Rp>
void
-function<_R()>::swap(function& __f)
+function<_Rp()>::swap(function& __f)
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
__f_ = (__base*)&__buf_;
}
else
- _STD::swap(__f_, __f.__f_);
+ _VSTD::swap(__f_, __f.__f_);
}
-template<class _R>
-_R
-function<_R()>::operator()() const
+template<class _Rp>
+_Rp
+function<_Rp()>::operator()() const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__f_ == 0)
#ifndef _LIBCPP_NO_RTTI
-template<class _R>
+template<class _Rp>
const std::type_info&
-function<_R()>::target_type() const
+function<_Rp()>::target_type() const
{
if (__f_ == 0)
return typeid(void);
return __f_->target_type();
}
-template<class _R>
-template <typename _T>
-_T*
-function<_R()>::target()
+template<class _Rp>
+template <typename _Tp>
+_Tp*
+function<_Rp()>::target()
{
if (__f_ == 0)
- return (_T*)0;
- return (_T*)__f_->target(typeid(_T));
+ return (_Tp*)0;
+ return (_Tp*)__f_->target(typeid(_Tp));
}
-template<class _R>
-template <typename _T>
-const _T*
-function<_R()>::target() const
+template<class _Rp>
+template <typename _Tp>
+const _Tp*
+function<_Rp()>::target() const
{
if (__f_ == 0)
- return (const _T*)0;
- return (const _T*)__f_->target(typeid(_T));
+ return (const _Tp*)0;
+ return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
-template<class _R, class _A0>
-class _LIBCPP_VISIBLE function<_R(_A0)>
- : public unary_function<_A0, _R>
+template<class _Rp, class _A0>
+class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0)>
+ : public unary_function<_A0, _Rp>
{
- typedef __function::__base<_R(_A0)> __base;
+ typedef __function::__base<_Rp(_A0)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _F>
+ template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _F&) {return true;}
+ static bool __not_null(const _Fp&) {return true;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0)) {return __p;}
- template <class _R2, class _C>
+ template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)()) {return __p;}
- template <class _R2, class _C>
+ static bool __not_null(_R2 (_Cp::*__p)()) {return __p;}
+ template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)() const) {return __p;}
- template <class _R2, class _C>
+ static bool __not_null(_R2 (_Cp::*__p)() const) {return __p;}
+ template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)() volatile) {return __p;}
- template <class _R2, class _C>
+ static bool __not_null(_R2 (_Cp::*__p)() volatile) {return __p;}
+ template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)() const volatile) {return __p;}
+ static bool __not_null(_R2 (_Cp::*__p)() const volatile) {return __p;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const function<_R(_B0)>& __p) {return __p;}
+ static bool __not_null(const function<_R2(_B0)>& __p) {return __p;}
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// 20.7.16.2.1, construct/copy/destroy:
_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 _Fp>
+ function(_Fp,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 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&);
- template<class _F, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _F __f,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp, class _Alloc>
+ function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
function& operator=(const function&);
function& operator=(nullptr_t);
- template<class _F>
+ template<class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
+ !is_integral<_Fp>::value,
function&
>::type
- operator=(_F);
+ operator=(_Fp);
~function();
// 20.7.16.2.2, function modifiers:
void swap(function&);
- template<class _F, class _Alloc>
+ template<class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- void assign(_F __f, const _Alloc& __a)
+ void assign(_Fp __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
bool operator!=(const function<_R2(_B0)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
- _R operator()(_A0) const;
+ _Rp operator()(_A0) const;
#ifndef _LIBCPP_NO_RTTI
// 20.7.16.2.5, function target access:
const std::type_info& target_type() const;
- template <typename _T> _T* target();
- template <typename _T> const _T* target() const;
+ template <typename _Tp> _Tp* target();
+ template <typename _Tp> const _Tp* target() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0>
-function<_R(_A0)>::function(const function& __f)
+template<class _Rp, class _A0>
+function<_Rp(_A0)>::function(const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0>
+template<class _Rp, class _A0>
template<class _Alloc>
-function<_R(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f)
+function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0>
-template <class _F>
-function<_R(_A0)>::function(_F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0>
+template <class _Fp>
+function<_Rp(_A0)>::function(_Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
{
- typedef __function::__func<_F, allocator<_F>, _R(_A0)> _FF;
+ typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(__f, allocator<_F>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0>
-template <class _F, class _Alloc>
-function<_R(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0>
+template <class _Fp, class _Alloc>
+function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
{
- typedef __function::__func<_F, _Alloc, _R(_A0)> _FF;
+ typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(__f, _Alloc(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0>
-function<_R(_A0)>&
-function<_R(_A0)>::operator=(const function& __f)
+template<class _Rp, class _A0>
+function<_Rp(_A0)>&
+function<_Rp(_A0)>::operator=(const function& __f)
{
function(__f).swap(*this);
return *this;
}
-template<class _R, class _A0>
-function<_R(_A0)>&
-function<_R(_A0)>::operator=(nullptr_t)
+template<class _Rp, class _A0>
+function<_Rp(_A0)>&
+function<_Rp(_A0)>::operator=(nullptr_t)
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
__f_ = 0;
}
-template<class _R, class _A0>
-template <class _F>
+template<class _Rp, class _A0>
+template <class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
- function<_R(_A0)>&
+ !is_integral<_Fp>::value,
+ function<_Rp(_A0)>&
>::type
-function<_R(_A0)>::operator=(_F __f)
+function<_Rp(_A0)>::operator=(_Fp __f)
{
- function(_STD::move(__f)).swap(*this);
+ function(_VSTD::move(__f)).swap(*this);
return *this;
}
-template<class _R, class _A0>
-function<_R(_A0)>::~function()
+template<class _Rp, class _A0>
+function<_Rp(_A0)>::~function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
__f_->destroy_deallocate();
}
-template<class _R, class _A0>
+template<class _Rp, class _A0>
void
-function<_R(_A0)>::swap(function& __f)
+function<_Rp(_A0)>::swap(function& __f)
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
__f_ = (__base*)&__buf_;
}
else
- _STD::swap(__f_, __f.__f_);
+ _VSTD::swap(__f_, __f.__f_);
}
-template<class _R, class _A0>
-_R
-function<_R(_A0)>::operator()(_A0 __a0) const
+template<class _Rp, class _A0>
+_Rp
+function<_Rp(_A0)>::operator()(_A0 __a0) const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__f_ == 0)
#ifndef _LIBCPP_NO_RTTI
-template<class _R, class _A0>
+template<class _Rp, class _A0>
const std::type_info&
-function<_R(_A0)>::target_type() const
+function<_Rp(_A0)>::target_type() const
{
if (__f_ == 0)
return typeid(void);
return __f_->target_type();
}
-template<class _R, class _A0>
-template <typename _T>
-_T*
-function<_R(_A0)>::target()
+template<class _Rp, class _A0>
+template <typename _Tp>
+_Tp*
+function<_Rp(_A0)>::target()
{
if (__f_ == 0)
- return (_T*)0;
- return (_T*)__f_->target(typeid(_T));
+ return (_Tp*)0;
+ return (_Tp*)__f_->target(typeid(_Tp));
}
-template<class _R, class _A0>
-template <typename _T>
-const _T*
-function<_R(_A0)>::target() const
+template<class _Rp, class _A0>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_A0)>::target() const
{
if (__f_ == 0)
- return (const _T*)0;
- return (const _T*)__f_->target(typeid(_T));
+ return (const _Tp*)0;
+ return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
-template<class _R, class _A0, class _A1>
-class _LIBCPP_VISIBLE function<_R(_A0, _A1)>
- : public binary_function<_A0, _A1, _R>
+template<class _Rp, class _A0, class _A1>
+class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1)>
+ : public binary_function<_A0, _A1, _Rp>
{
- typedef __function::__base<_R(_A0, _A1)> __base;
+ typedef __function::__base<_Rp(_A0, _A1)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _F>
+ template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _F&) {return true;}
+ static bool __not_null(const _Fp&) {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>
+ template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)(_B1)) {return __p;}
- template <class _R2, class _C, class _B1>
+ static bool __not_null(_R2 (_Cp::*__p)(_B1)) {return __p;}
+ template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)(_B1) const) {return __p;}
- template <class _R2, class _C, class _B1>
+ static bool __not_null(_R2 (_Cp::*__p)(_B1) const) {return __p;}
+ template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)(_B1) volatile) {return __p;}
- template <class _R2, class _C, class _B1>
+ static bool __not_null(_R2 (_Cp::*__p)(_B1) volatile) {return __p;}
+ template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)(_B1) const volatile) {return __p;}
+ static bool __not_null(_R2 (_Cp::*__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;}
+ static bool __not_null(const function<_R2(_B0, _B1)>& __p) {return __p;}
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// 20.7.16.2.1, construct/copy/destroy:
_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 _Fp>
+ function(_Fp,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 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&);
- template<class _F, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _F __f,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp, class _Alloc>
+ function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
function& operator=(const function&);
function& operator=(nullptr_t);
- template<class _F>
+ template<class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
+ !is_integral<_Fp>::value,
function&
>::type
- operator=(_F);
+ operator=(_Fp);
~function();
// 20.7.16.2.2, function modifiers:
void swap(function&);
- template<class _F, class _Alloc>
+ template<class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- void assign(_F __f, const _Alloc& __a)
+ void assign(_Fp __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
bool operator!=(const function<_R2(_B0, _B1)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
- _R operator()(_A0, _A1) const;
+ _Rp operator()(_A0, _A1) const;
#ifndef _LIBCPP_NO_RTTI
// 20.7.16.2.5, function target access:
const std::type_info& target_type() const;
- template <typename _T> _T* target();
- template <typename _T> const _T* target() const;
+ template <typename _Tp> _Tp* target();
+ template <typename _Tp> const _Tp* target() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0, class _A1>
-function<_R(_A0, _A1)>::function(const function& __f)
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>::function(const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0, class _A1>
+template<class _Rp, class _A0, class _A1>
template<class _Alloc>
-function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f)
+function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0, class _A1>
-template <class _F>
-function<_R(_A0, _A1)>::function(_F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0, class _A1>
+template <class _Fp>
+function<_Rp(_A0, _A1)>::function(_Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
{
- typedef __function::__func<_F, allocator<_F>, _R(_A0, _A1)> _FF;
+ typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(__f, allocator<_F>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0, class _A1>
-template <class _F, class _Alloc>
-function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0, class _A1>
+template <class _Fp, class _Alloc>
+function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
{
- typedef __function::__func<_F, _Alloc, _R(_A0, _A1)> _FF;
+ typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(__f, _Alloc(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0, class _A1>
-function<_R(_A0, _A1)>&
-function<_R(_A0, _A1)>::operator=(const function& __f)
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>&
+function<_Rp(_A0, _A1)>::operator=(const function& __f)
{
function(__f).swap(*this);
return *this;
}
-template<class _R, class _A0, class _A1>
-function<_R(_A0, _A1)>&
-function<_R(_A0, _A1)>::operator=(nullptr_t)
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>&
+function<_Rp(_A0, _A1)>::operator=(nullptr_t)
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
__f_ = 0;
}
-template<class _R, class _A0, class _A1>
-template <class _F>
+template<class _Rp, class _A0, class _A1>
+template <class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
- function<_R(_A0, _A1)>&
+ !is_integral<_Fp>::value,
+ function<_Rp(_A0, _A1)>&
>::type
-function<_R(_A0, _A1)>::operator=(_F __f)
+function<_Rp(_A0, _A1)>::operator=(_Fp __f)
{
- function(_STD::move(__f)).swap(*this);
+ function(_VSTD::move(__f)).swap(*this);
return *this;
}
-template<class _R, class _A0, class _A1>
-function<_R(_A0, _A1)>::~function()
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>::~function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
__f_->destroy_deallocate();
}
-template<class _R, class _A0, class _A1>
+template<class _Rp, class _A0, class _A1>
void
-function<_R(_A0, _A1)>::swap(function& __f)
+function<_Rp(_A0, _A1)>::swap(function& __f)
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
__f_ = (__base*)&__buf_;
}
else
- _STD::swap(__f_, __f.__f_);
+ _VSTD::swap(__f_, __f.__f_);
}
-template<class _R, class _A0, class _A1>
-_R
-function<_R(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const
+template<class _Rp, class _A0, class _A1>
+_Rp
+function<_Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__f_ == 0)
#ifndef _LIBCPP_NO_RTTI
-template<class _R, class _A0, class _A1>
+template<class _Rp, class _A0, class _A1>
const std::type_info&
-function<_R(_A0, _A1)>::target_type() const
+function<_Rp(_A0, _A1)>::target_type() const
{
if (__f_ == 0)
return typeid(void);
return __f_->target_type();
}
-template<class _R, class _A0, class _A1>
-template <typename _T>
-_T*
-function<_R(_A0, _A1)>::target()
+template<class _Rp, class _A0, class _A1>
+template <typename _Tp>
+_Tp*
+function<_Rp(_A0, _A1)>::target()
{
if (__f_ == 0)
- return (_T*)0;
- return (_T*)__f_->target(typeid(_T));
+ return (_Tp*)0;
+ return (_Tp*)__f_->target(typeid(_Tp));
}
-template<class _R, class _A0, class _A1>
-template <typename _T>
-const _T*
-function<_R(_A0, _A1)>::target() const
+template<class _Rp, class _A0, class _A1>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_A0, _A1)>::target() const
{
if (__f_ == 0)
- return (const _T*)0;
- return (const _T*)__f_->target(typeid(_T));
+ return (const _Tp*)0;
+ return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
-template<class _R, class _A0, class _A1, class _A2>
-class _LIBCPP_VISIBLE function<_R(_A0, _A1, _A2)>
+template<class _Rp, class _A0, class _A1, class _A2>
+class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1, _A2)>
{
- typedef __function::__base<_R(_A0, _A1, _A2)> __base;
+ typedef __function::__base<_Rp(_A0, _A1, _A2)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _F>
+ template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _F&) {return true;}
+ static bool __not_null(const _Fp&) {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>
+ template <class _R2, class _Cp, 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>
+ static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2)) {return __p;}
+ template <class _R2, class _Cp, 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>
+ static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const) {return __p;}
+ template <class _R2, class _Cp, 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>
+ static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) volatile) {return __p;}
+ template <class _R2, class _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)(_B1, _B2) const volatile) {return __p;}
+ static bool __not_null(_R2 (_Cp::*__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;}
+ static bool __not_null(const function<_R2(_B0, _B1, _B2)>& __p) {return __p;}
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// 20.7.16.2.1, construct/copy/destroy:
_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 _Fp>
+ function(_Fp,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 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&);
- template<class _F, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _F __f,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp, class _Alloc>
+ function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
function& operator=(const function&);
function& operator=(nullptr_t);
- template<class _F>
+ template<class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
+ !is_integral<_Fp>::value,
function&
>::type
- operator=(_F);
+ operator=(_Fp);
~function();
// 20.7.16.2.2, function modifiers:
void swap(function&);
- template<class _F, class _Alloc>
+ template<class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- void assign(_F __f, const _Alloc& __a)
+ void assign(_Fp __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
- _R operator()(_A0, _A1, _A2) const;
+ _Rp operator()(_A0, _A1, _A2) const;
#ifndef _LIBCPP_NO_RTTI
// 20.7.16.2.5, function target access:
const std::type_info& target_type() const;
- template <typename _T> _T* target();
- template <typename _T> const _T* target() const;
+ template <typename _Tp> _Tp* target();
+ template <typename _Tp> const _Tp* target() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0, class _A1, class _A2>
-function<_R(_A0, _A1, _A2)>::function(const function& __f)
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>::function(const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0, class _A1, class _A2>
+template<class _Rp, class _A0, class _A1, class _A2>
template<class _Alloc>
-function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&,
+function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&,
const function& __f)
{
if (__f.__f_ == 0)
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0, class _A1, class _A2>
-template <class _F>
-function<_R(_A0, _A1, _A2)>::function(_F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0, class _A1, class _A2>
+template <class _Fp>
+function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
{
- typedef __function::__func<_F, allocator<_F>, _R(_A0, _A1, _A2)> _FF;
+ typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(__f, allocator<_F>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0, class _A1, class _A2>
-template <class _F, class _Alloc>
-function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0, class _A1, class _A2>
+template <class _Fp, class _Alloc>
+function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
{
- typedef __function::__func<_F, _Alloc, _R(_A0, _A1, _A2)> _FF;
+ typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(__f, _Alloc(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0, class _A1, class _A2>
-function<_R(_A0, _A1, _A2)>&
-function<_R(_A0, _A1, _A2)>::operator=(const function& __f)
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>&
+function<_Rp(_A0, _A1, _A2)>::operator=(const function& __f)
{
function(__f).swap(*this);
return *this;
}
-template<class _R, class _A0, class _A1, class _A2>
-function<_R(_A0, _A1, _A2)>&
-function<_R(_A0, _A1, _A2)>::operator=(nullptr_t)
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>&
+function<_Rp(_A0, _A1, _A2)>::operator=(nullptr_t)
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
__f_ = 0;
}
-template<class _R, class _A0, class _A1, class _A2>
-template <class _F>
+template<class _Rp, class _A0, class _A1, class _A2>
+template <class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
- function<_R(_A0, _A1, _A2)>&
+ !is_integral<_Fp>::value,
+ function<_Rp(_A0, _A1, _A2)>&
>::type
-function<_R(_A0, _A1, _A2)>::operator=(_F __f)
+function<_Rp(_A0, _A1, _A2)>::operator=(_Fp __f)
{
- function(_STD::move(__f)).swap(*this);
+ function(_VSTD::move(__f)).swap(*this);
return *this;
}
-template<class _R, class _A0, class _A1, class _A2>
-function<_R(_A0, _A1, _A2)>::~function()
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>::~function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
__f_->destroy_deallocate();
}
-template<class _R, class _A0, class _A1, class _A2>
+template<class _Rp, class _A0, class _A1, class _A2>
void
-function<_R(_A0, _A1, _A2)>::swap(function& __f)
+function<_Rp(_A0, _A1, _A2)>::swap(function& __f)
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
__f_ = (__base*)&__buf_;
}
else
- _STD::swap(__f_, __f.__f_);
+ _VSTD::swap(__f_, __f.__f_);
}
-template<class _R, class _A0, class _A1, class _A2>
-_R
-function<_R(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const
+template<class _Rp, class _A0, class _A1, class _A2>
+_Rp
+function<_Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__f_ == 0)
#ifndef _LIBCPP_NO_RTTI
-template<class _R, class _A0, class _A1, class _A2>
+template<class _Rp, class _A0, class _A1, class _A2>
const std::type_info&
-function<_R(_A0, _A1, _A2)>::target_type() const
+function<_Rp(_A0, _A1, _A2)>::target_type() const
{
if (__f_ == 0)
return typeid(void);
return __f_->target_type();
}
-template<class _R, class _A0, class _A1, class _A2>
-template <typename _T>
-_T*
-function<_R(_A0, _A1, _A2)>::target()
+template<class _Rp, class _A0, class _A1, class _A2>
+template <typename _Tp>
+_Tp*
+function<_Rp(_A0, _A1, _A2)>::target()
{
if (__f_ == 0)
- return (_T*)0;
- return (_T*)__f_->target(typeid(_T));
+ return (_Tp*)0;
+ return (_Tp*)__f_->target(typeid(_Tp));
}
-template<class _R, class _A0, class _A1, class _A2>
-template <typename _T>
-const _T*
-function<_R(_A0, _A1, _A2)>::target() const
+template<class _Rp, class _A0, class _A1, class _A2>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_A0, _A1, _A2)>::target() const
{
if (__f_ == 0)
- return (const _T*)0;
- return (const _T*)__f_->target(typeid(_T));
+ return (const _Tp*)0;
+ return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator==(const function<_F>& __f, nullptr_t) {return !__f;}
+operator==(const function<_Fp>& __f, nullptr_t) {return !__f;}
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator==(nullptr_t, const function<_F>& __f) {return !__f;}
+operator==(nullptr_t, const function<_Fp>& __f) {return !__f;}
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(const function<_F>& __f, nullptr_t) {return (bool)__f;}
+operator!=(const function<_Fp>& __f, nullptr_t) {return (bool)__f;}
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(nullptr_t, const function<_F>& __f) {return (bool)__f;}
+operator!=(nullptr_t, const function<_Fp>& __f) {return (bool)__f;}
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(function<_F>& __x, function<_F>& __y)
+swap(function<_Fp>& __x, function<_Fp>& __y)
{return __x.swap(__y);}
template<class _Tp> struct __is_bind_expression : public false_type {};
-template<class _Tp> struct _LIBCPP_VISIBLE is_bind_expression
+template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY 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 _LIBCPP_VISIBLE is_placeholder
+template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_placeholder
: public __is_placeholder<typename remove_cv<_Tp>::type> {};
namespace placeholders
{
-template <int _N> struct __ph {};
+template <int _Np> struct __ph {};
extern __ph<1> _1;
extern __ph<2> _2;
} // placeholders
-template<int _N>
-struct __is_placeholder<placeholders::__ph<_N> >
- : public integral_constant<int, _N> {};
+template<int _Np>
+struct __is_placeholder<placeholders::__ph<_Np> >
+ : public integral_constant<int, _Np> {};
template <class _Tp, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
typename __mu_return1<true, _Ti, _Uj...>::type
__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>)
{
- __ti(_STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj))...);
+ __ti(_VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj))...);
}
template <class _Ti, class ..._Uj>
{
const size_t _Indx = is_placeholder<_Ti>::value - 1;
// compiler bug workaround
- typename tuple_element<_Indx, _Uj>::type __t = get<_Indx>(__uj);
+ typename tuple_element<_Indx, _Uj>::type __t = _VSTD::get<_Indx>(__uj);
return __t;
-// return _STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj));
+// return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj));
}
template <class _Ti, class _Uj>
typedef _Ti& type;
};
-template <class _F, class _BoundArgs, class _TupleUj>
+template <class _Fp, class _BoundArgs, class _TupleUj>
struct __bind_return;
-template <class _F, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __ref_return
<
- _F&,
+ _Fp&,
typename __mu_return
<
_BoundArgs,
>::type type;
};
-template <class _F, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj>
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __ref_return
<
- _F&,
+ _Fp&,
typename __mu_return
<
const _BoundArgs,
>::type type;
};
-template <class _F, class _BoundArgs, size_t ..._Indx, class _Args>
+template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
inline _LIBCPP_INLINE_VISIBILITY
-typename __bind_return<_F, _BoundArgs, _Args>::type
-__apply_functor(_F& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
+typename __bind_return<_Fp, _BoundArgs, _Args>::type
+__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
_Args&& __args)
{
- return __invoke(__f, __mu(get<_Indx>(__bound_args), __args)...);
+ return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...);
}
-template<class _F, class ..._BoundArgs>
+template<class _Fp, class ..._BoundArgs>
class __bind
{
- _F __f_;
+ _Fp __f_;
tuple<_BoundArgs...> __bound_args_;
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
- template <class _G, class ..._BA>
- explicit __bind(_G&& __f, _BA&& ...__bound_args)
- : __f_(_STD::forward<_G>(__f)),
- __bound_args_(_STD::forward<_BA>(__bound_args)...) {}
+ template <class _Gp, class ..._BA>
+ explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
+ : __f_(_VSTD::forward<_Gp>(__f)),
+ __bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
- typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
+ typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args)
{
// compiler bug workaround
}
template <class ..._Args>
- typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
+ typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args) const
{
return __apply_functor(__f_, __bound_args_, __indices(),
}
};
-template<class _F, class ..._BoundArgs>
-struct __is_bind_expression<__bind<_F, _BoundArgs...> > : public true_type {};
+template<class _Fp, class ..._BoundArgs>
+struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
-template<class _R, class _F, class ..._BoundArgs>
+template<class _Rp, class _Fp, class ..._BoundArgs>
class __bind_r
- : public __bind<_F, _BoundArgs...>
+ : public __bind<_Fp, _BoundArgs...>
{
- typedef __bind<_F, _BoundArgs...> base;
+ typedef __bind<_Fp, _BoundArgs...> base;
public:
- typedef _R result_type;
+ typedef _Rp result_type;
- template <class _G, class ..._BA>
- explicit __bind_r(_G&& __f, _BA&& ...__bound_args)
- : base(_STD::forward<_G>(__f),
- _STD::forward<_BA>(__bound_args)...) {}
+ template <class _Gp, class ..._BA>
+ explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
+ : base(_VSTD::forward<_Gp>(__f),
+ _VSTD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
result_type
operator()(_Args&& ...__args)
{
- return base::operator()(_STD::forward<_Args>(__args)...);
+ return base::operator()(_VSTD::forward<_Args>(__args)...);
}
template <class ..._Args>
result_type
operator()(_Args&& ...__args) const
{
- return base::operator()(_STD::forward<_Args>(__args)...);
+ return base::operator()(_VSTD::forward<_Args>(__args)...);
}
};
-template<class _R, class _F, class ..._BoundArgs>
-struct __is_bind_expression<__bind_r<_R, _F, _BoundArgs...> > : public true_type {};
+template<class _Rp, class _Fp, class ..._BoundArgs>
+struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
-template<class _F, class ..._BoundArgs>
+template<class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
-__bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...>
-bind(_F&& __f, _BoundArgs&&... __bound_args)
+__bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
- typedef __bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
- return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
+ typedef __bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type;
+ return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
}
-template<class _R, class _F, class ..._BoundArgs>
+template<class _Rp, class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
-__bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...>
-bind(_F&& __f, _BoundArgs&&... __bound_args)
+__bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
- typedef __bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
- return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
+ typedef __bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type;
+ return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
}
*/
#include <type_traits>
#include <typeinfo>
#include <exception>
+#include <new>
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
+#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
-struct _LIBCPP_VISIBLE unary_function
+struct _LIBCPP_TYPE_VIS_ONLY unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
template <class _Arg1, class _Arg2, class _Result>
-struct _LIBCPP_VISIBLE binary_function
+struct _LIBCPP_TYPE_VIS_ONLY binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
-template <class _Tp> struct _LIBCPP_VISIBLE hash;
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
template <class _Tp>
struct __has_result_type
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::result_type* = 0);
public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
+#if _LIBCPP_STD_VER > 11
+template <class _Tp = void>
+#else
+template <class _Tp>
+#endif
+struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
+{
+ _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ {return __x < __y;}
+};
+
+#if _LIBCPP_STD_VER > 11
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY less<void>
+{
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+ auto operator()(_T1&& __t, _T2&& __u) const
+ { return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
+ typedef void is_transparent;
+};
+#endif
+
+// addressof
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+addressof(_Tp& __x) _NOEXCEPT
+{
+ return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
+}
+
+#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
+// Objective-C++ Automatic Reference Counting uses qualified pointers
+// that require special addressof() signatures. When
+// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
+// itself is providing these definitions. Otherwise, we provide them.
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__strong _Tp*
+addressof(__strong _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+
+#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__weak _Tp*
+addressof(__weak _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+#endif
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__autoreleasing _Tp*
+addressof(__autoreleasing _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__unsafe_unretained _Tp*
+addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+#endif
+
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
struct __derives_from_unary_function
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
static __two __test(...);
- template <class _A, class _R>
- static unary_function<_A, _R>
- __test(const volatile unary_function<_A, _R>*);
+ template <class _Ap, class _Rp>
+ static unary_function<_Ap, _Rp>
+ __test(const volatile unary_function<_Ap, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
struct __derives_from_binary_function
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
static __two __test(...);
- template <class _A1, class _A2, class _R>
- static binary_function<_A1, _A2, _R>
- __test(const volatile binary_function<_A1, _A2, _R>*);
+ template <class _A1, class _A2, class _Rp>
+ static binary_function<_A1, _A2, _Rp>
+ __test(const volatile binary_function<_A1, _A2, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
// 0 argument case
-template <class _R>
-struct __weak_result_type<_R ()>
+template <class _Rp>
+struct __weak_result_type<_Rp ()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R>
-struct __weak_result_type<_R (&)()>
+template <class _Rp>
+struct __weak_result_type<_Rp (&)()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R>
-struct __weak_result_type<_R (*)()>
+template <class _Rp>
+struct __weak_result_type<_Rp (*)()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
// 1 argument case
-template <class _R, class _A1>
-struct __weak_result_type<_R (_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _A1>
-struct __weak_result_type<_R (&)(_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (&)(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _A1>
-struct __weak_result_type<_R (*)(_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (*)(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)()>
- : public unary_function<_C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)()>
+ : public unary_function<_Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() const>
- : public unary_function<const _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const>
+ : public unary_function<const _Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() volatile>
- : public unary_function<volatile _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() volatile>
+ : public unary_function<volatile _Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() const volatile>
- : public unary_function<const volatile _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const volatile>
+ : public unary_function<const volatile _Cp*, _Rp>
{
};
// 2 argument case
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (*)(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (*)(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (&)(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (&)(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1)>
- : public binary_function<_C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1)>
+ : public binary_function<_Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) const>
- : public binary_function<const _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
+ : public binary_function<const _Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) volatile>
- : public binary_function<volatile _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
+ : public binary_function<volatile _Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) const volatile>
- : public binary_function<const volatile _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
+ : public binary_function<const volatile _Cp*, _A1, _Rp>
{
};
// 3 or more arguments
-template <class _R, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
+template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
+struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
+template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
+struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
+template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
+struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
// __invoke
-// first bullet
+// bullets 1 and 2
-template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
+template <class _Fp, class _A0, class ..._Args,
+ class>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- sizeof...(_Param) == sizeof...(_Arg) &&
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
->::type
-__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
-{
- return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
-}
-
-template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- sizeof...(_Param) == sizeof...(_Arg) &&
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
->::type
-__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
-{
- return (_STD::forward<const _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
-}
-
-template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- sizeof...(_Param) == sizeof...(_Arg) &&
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
->::type
-__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
-{
- return (_STD::forward<volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
-}
-
-template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- sizeof...(_Param) == sizeof...(_Arg) &&
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
->::type
-__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
-{
- return (_STD::forward<const volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
-}
-
-// second bullet
-
-template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- sizeof...(_Param) == sizeof...(_Arg) &&
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
->::type
-__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
-{
- return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
+auto
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+ -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
+{
+ return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
}
-template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
+template <class _Fp, class _A0, class ..._Args,
+ class>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- sizeof...(_Param) == sizeof...(_Arg) &&
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
->::type
-__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
-{
- return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
+auto
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+ -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
+{
+ return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
}
-template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- sizeof...(_Param) == sizeof...(_Arg) &&
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
->::type
-__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
-{
- return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
-}
+// bullets 3 and 4
-template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
+template <class _Fp, class _A0,
+ class>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- sizeof...(_Param) == sizeof...(_Arg) &&
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
->::type
-__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
-{
- return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
+auto
+__invoke(_Fp&& __f, _A0&& __a0)
+ -> decltype(_VSTD::forward<_A0>(__a0).*__f)
+{
+ return _VSTD::forward<_A0>(__a0).*__f;
}
-// third bullet
-
-template <class _R, class _T, class _T1>
+template <class _Fp, class _A0,
+ class>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- typename __apply_cv<_T1, _R>::type&&
->::type
-__invoke(_R _T::* __f, _T1&& __t1)
-{
- return _STD::forward<_T1>(__t1).*__f;
-}
-
-// forth bullet
-
-template <class _T1, class _R, bool>
-struct __4th_helper
-{
-};
-
-template <class _T1, class _R>
-struct __4th_helper<_T1, _R, true>
+auto
+__invoke(_Fp&& __f, _A0&& __a0)
+ -> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
{
- typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
-};
-
-template <class _R, class _T, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __4th_helper<_T1, _R,
- !is_base_of<_T,
- typename remove_reference<_T1>::type
- >::value
- >::type&&
-__invoke(_R _T::* __f, _T1&& __t1)
-{
- return (*_STD::forward<_T1>(__t1)).*__f;
+ return (*_VSTD::forward<_A0>(__a0)).*__f;
}
-// fifth bullet
+// bullet 5
-template <class _F, class ..._T>
+template <class _Fp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
-typename result_of<_F(_T...)>::type
-__invoke(_F&& __f, _T&& ...__t)
+auto
+__invoke(_Fp&& __f, _Args&& ...__args)
+ -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
{
- return _STD::forward<_F>(__f)(_STD::forward<_T>(__t)...);
+ return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class ..._Args>
struct __invoke_return
{
- typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_Args>()...)) type;
+ typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
};
template <class _Tp>
-class _LIBCPP_VISIBLE reference_wrapper
+class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
: public __weak_result_type<_Tp>
{
public:
public:
// construct/copy/destroy
- _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) : __f_(&__f) {}
+ _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
+ : __f_(_VSTD::addressof(__f)) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
#endif
// access
- _LIBCPP_INLINE_VISIBILITY operator type& () const {return *__f_;}
- _LIBCPP_INLINE_VISIBILITY type& get() const {return *__f_;}
+ _LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
+ _LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
- typename __invoke_return<type&, _ArgTypes...>::type
+ typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
- return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);
+ return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
}
};
-template <class _Tp> struct ____is_reference_wrapper : public false_type {};
-template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
+template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
+template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
template <class _Tp> struct __is_reference_wrapper
- : public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
+ : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp>
-ref(_Tp& __t)
+ref(_Tp& __t) _NOEXCEPT
{
return reference_wrapper<_Tp>(__t);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp>
-ref(reference_wrapper<_Tp> __t)
+ref(reference_wrapper<_Tp> __t) _NOEXCEPT
{
return ref(__t.get());
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp>
-cref(const _Tp& __t)
+cref(const _Tp& __t) _NOEXCEPT
{
return reference_wrapper<const _Tp>(__t);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp>
-cref(reference_wrapper<_Tp> __t)
+cref(reference_wrapper<_Tp> __t) _NOEXCEPT
{
return cref(__t.get());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-template <class _Tp> void ref(const _Tp&& __t) = delete;
-template <class _Tp> void cref(const _Tp&& __t) = delete;
+template <class _Tp> void ref(const _Tp&&) = delete;
+template <class _Tp> void cref(const _Tp&&) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-template <class _Tp> void ref(const _Tp&& __t);// = delete;
-template <class _Tp> void cref(const _Tp&& __t);// = delete;
+template <class _Tp> void ref(const _Tp&&);// = delete;
+template <class _Tp> void cref(const _Tp&&);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // _LIBCPP_HAS_NO_VARIADICS
+#if _LIBCPP_STD_VER > 11
+template <class _Tp1, class _Tp2 = void>
+struct __is_transparent
+{
+private:
+ struct __two {char __lx; char __lxx;};
+ template <class _Up> static __two __test(...);
+ template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+public:
+ static const bool value = sizeof(__test<_Tp1>(0)) == 1;
+};
+#endif
+
+// allocator_arg_t
+
+struct _LIBCPP_TYPE_VIS_ONLY allocator_arg_t { };
+
+#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
+extern const allocator_arg_t allocator_arg;
+#else
+constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+#endif
+
+// uses_allocator
+
+template <class _Tp>
+struct __has_allocator_type
+{
+private:
+ struct __two {char __lx; char __lxx;};
+ template <class _Up> static __two __test(...);
+ template <class _Up> static char __test(typename _Up::allocator_type* = 0);
+public:
+ static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
+struct __uses_allocator
+ : public integral_constant<bool,
+ is_convertible<_Alloc, typename _Tp::allocator_type>::value>
+{
+};
+
+template <class _Tp, class _Alloc>
+struct __uses_allocator<_Tp, _Alloc, false>
+ : public false_type
+{
+};
+
+template <class _Tp, class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY uses_allocator
+ : public __uses_allocator<_Tp, _Alloc>
+{
+};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+// allocator construction
+
+template <class _Tp, class _Alloc, class ..._Args>
+struct __uses_alloc_ctor_imp
+{
+ static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
+ static const bool __ic =
+ is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
+ static const int value = __ua ? 2 - __ic : 0;
+};
+
+template <class _Tp, class _Alloc, class ..._Args>
+struct __uses_alloc_ctor
+ : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
+ {};
+
+template <class _Tp, class _Allocator, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
+{
+ new (__storage) _Tp (_VSTD::forward<_Args>(__args)...);
+}
+
+template <class _Tp, class _Allocator, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
+{
+ new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...);
+}
+
+template <class _Tp, class _Allocator, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
+{
+ new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
+}
+
+template <class _Tp, class _Allocator, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
+{
+ __user_alloc_construct_impl(
+ __uses_alloc_ctor<_Tp, _Allocator>(),
+ __storage, __a, _VSTD::forward<_Args>(__args)...
+ );
+}
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_FUNCTIONAL_BASE
struct __derives_from_unary_function
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
static __two __test(...);
- template <class _A, class _R>
- static unary_function<_A, _R>
- __test(const volatile unary_function<_A, _R>*);
+ template <class _Ap, class _Rp>
+ static unary_function<_Ap, _Rp>
+ __test(const volatile unary_function<_Ap, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
struct __derives_from_binary_function
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
static __two __test(...);
- template <class _A1, class _A2, class _R>
- static binary_function<_A1, _A2, _R>
- __test(const volatile binary_function<_A1, _A2, _R>*);
+ template <class _A1, class _A2, class _Rp>
+ static binary_function<_A1, _A2, _Rp>
+ __test(const volatile binary_function<_A1, _A2, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
// 0 argument case
-template <class _R>
-struct __weak_result_type<_R ()>
+template <class _Rp>
+struct __weak_result_type<_Rp ()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R>
-struct __weak_result_type<_R (&)()>
+template <class _Rp>
+struct __weak_result_type<_Rp (&)()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R>
-struct __weak_result_type<_R (*)()>
+template <class _Rp>
+struct __weak_result_type<_Rp (*)()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
// 1 argument case
-template <class _R, class _A1>
-struct __weak_result_type<_R (_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _A1>
-struct __weak_result_type<_R (&)(_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (&)(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _A1>
-struct __weak_result_type<_R (*)(_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (*)(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)()>
- : public unary_function<_C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)()>
+ : public unary_function<_Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() const>
- : public unary_function<const _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const>
+ : public unary_function<const _Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() volatile>
- : public unary_function<volatile _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() volatile>
+ : public unary_function<volatile _Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() const volatile>
- : public unary_function<const volatile _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const volatile>
+ : public unary_function<const volatile _Cp*, _Rp>
{
};
// 2 argument case
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (*)(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (*)(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (&)(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (&)(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1)>
- : public binary_function<_C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1)>
+ : public binary_function<_Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) const>
- : public binary_function<const _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
+ : public binary_function<const _Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) volatile>
- : public binary_function<volatile _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
+ : public binary_function<volatile _Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) const volatile>
- : public binary_function<const volatile _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
+ : public binary_function<const volatile _Cp*, _A1, _Rp>
{
};
// 3 or more arguments
-template <class _R, class _A1, class _A2, class _A3>
-struct __weak_result_type<_R (_A1, _A2, _A3)>
+template <class _Rp, class _A1, class _A2, class _A3>
+struct __weak_result_type<_Rp (_A1, _A2, _A3)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _A1, class _A2, class _A3>
-struct __weak_result_type<_R (&)(_A1, _A2, _A3)>
+template <class _Rp, class _A1, class _A2, class _A3>
+struct __weak_result_type<_Rp (&)(_A1, _A2, _A3)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _A1, class _A2, class _A3>
-struct __weak_result_type<_R (*)(_A1, _A2, _A3)>
+template <class _Rp, class _A1, class _A2, class _A3>
+struct __weak_result_type<_Rp (*)(_A1, _A2, _A3)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2>
-struct __weak_result_type<_R (_C::*)(_A1, _A2)>
+template <class _Rp, class _Cp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2>
-struct __weak_result_type<_R (_C::*)(_A1, _A2) const>
+template <class _Rp, class _Cp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2) const>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2>
-struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
+template <class _Rp, class _Cp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2) volatile>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
// __invoke
// template <class _Tp, class _A0, bool>
// struct __ref_return1_member_data1;
//
-// template <class _R, class _C, class _A0>
-// struct __ref_return1_member_data1<_R _C::*, _A0, true>
+// template <class _Rp, class _Cp, class _A0>
+// struct __ref_return1_member_data1<_Rp _Cp::*, _A0, true>
// {
-// typedef typename __apply_cv<_A0, _R>::type& type;
+// typedef typename __apply_cv<_A0, _Rp>::type& type;
// };
//
-// template <class _R, class _C, class _A0>
-// struct __ref_return1_member_data1<_R _C::*, _A0, false>
+// template <class _Rp, class _Cp, class _A0>
+// struct __ref_return1_member_data1<_Rp _Cp::*, _A0, false>
// {
// static _A0 __a;
-// typedef typename __apply_cv<decltype(*__a), _R>::type& type;
+// typedef typename __apply_cv<decltype(*__a), _Rp>::type& type;
// };
//
// template <class _Tp, class _A0>
// struct __ref_return1_member_data;
//
-// template <class _R, class _C, class _A0>
-// struct __ref_return1_member_data<_R _C::*, _A0>
-// : public __ref_return1_member_data1<_R _C::*, _A0,
-// is_same<typename remove_cv<_C>::type,
+// template <class _Rp, class _Cp, class _A0>
+// struct __ref_return1_member_data<_Rp _Cp::*, _A0>
+// : public __ref_return1_member_data1<_Rp _Cp::*, _A0,
+// is_same<typename remove_cv<_Cp>::type,
// typename remove_cv<typename remove_reference<_A0>::type>::type>::value>
// {
// };
// first bullet
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(), _T1& __t1)
+__invoke(_Rp (_Tp::*__f)(), _T1& __t1)
{
return (__t1.*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0), _T1& __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0), _T1& __t1, _A0& __a0)
{
return (__t1.*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1), _T1& __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1& __t1, _A0& __a0, _A1& __a1)
{
return (__t1.*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2), _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return (__t1.*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() const, _T1& __t1)
+__invoke(_Rp (_Tp::*__f)() const, _T1& __t1)
{
return (__t1.*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) const, _T1& __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) const, _T1& __t1, _A0& __a0)
{
return (__t1.*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) const, _T1& __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1& __t1, _A0& __a0, _A1& __a1)
{
return (__t1.*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) const, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return (__t1.*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() volatile, _T1& __t1)
+__invoke(_Rp (_Tp::*__f)() volatile, _T1& __t1)
{
return (__t1.*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) volatile, _T1& __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1& __t1, _A0& __a0)
{
return (__t1.*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) volatile, _T1& __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1& __t1, _A0& __a0, _A1& __a1)
{
return (__t1.*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return (__t1.*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() const volatile, _T1& __t1)
+__invoke(_Rp (_Tp::*__f)() const volatile, _T1& __t1)
{
return (__t1.*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) const volatile, _T1& __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1& __t1, _A0& __a0)
{
return (__t1.*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) const volatile, _T1& __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1& __t1, _A0& __a0, _A1& __a1)
{
return (__t1.*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) const volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return (__t1.*__f)(__a0, __a1, __a2);
}
// second bullet
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(), _T1 __t1)
+__invoke(_Rp (_Tp::*__f)(), _T1 __t1)
{
return ((*__t1).*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0), _T1 __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0), _T1 __t1, _A0& __a0)
{
return ((*__t1).*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1), _T1 __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1 __t1, _A0& __a0, _A1& __a1)
{
return ((*__t1).*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2), _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return ((*__t1).*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() const, _T1 __t1)
+__invoke(_Rp (_Tp::*__f)() const, _T1 __t1)
{
return ((*__t1).*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) const, _T1 __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) const, _T1 __t1, _A0& __a0)
{
return ((*__t1).*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) const, _T1 __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1 __t1, _A0& __a0, _A1& __a1)
{
return ((*__t1).*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) const, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return ((*__t1).*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() volatile, _T1 __t1)
+__invoke(_Rp (_Tp::*__f)() volatile, _T1 __t1)
{
return ((*__t1).*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) volatile, _T1 __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1 __t1, _A0& __a0)
{
return ((*__t1).*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) volatile, _T1 __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1 __t1, _A0& __a0, _A1& __a1)
{
return ((*__t1).*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return ((*__t1).*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() const volatile, _T1 __t1)
+__invoke(_Rp (_Tp::*__f)() const volatile, _T1 __t1)
{
return ((*__t1).*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) const volatile, _T1 __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1 __t1, _A0& __a0)
{
return ((*__t1).*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) const volatile, _T1 __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1 __t1, _A0& __a0, _A1& __a1)
{
return ((*__t1).*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) const volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return ((*__t1).*__f)(__a0, __a1, __a2);
}
// third bullet
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- typename __apply_cv<_T1, _R>::type&
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ typename __apply_cv<_T1, _Rp>::type&
>::type
-__invoke(_R _T::* __f, _T1& __t1)
+__invoke(_Rp _Tp::* __f, _T1& __t1)
{
return __t1.*__f;
}
-template <class _R, class _T>
+template <class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
-__invoke(_R _T::*)
+__invoke(_Rp _Tp::*)
{
}
-// template <class _D, class _R, class _T, class _T1>
+// template <class _Dp, class _Rp, class _Tp, class _T1>
// inline _LIBCPP_INLINE_VISIBILITY
// typename enable_if
// <
-// is_base_of<_T, typename remove_reference<_T1>::type>::value,
-// typename __ref_return1<_R _T::*, _T1>::type
+// is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+// typename __ref_return1<_Rp _Tp::*, _T1>::type
// >::type
-// __invoke(_R _T::* __f, _T1& __t1)
+// __invoke(_Rp _Tp::* __f, _T1& __t1)
// {
// return __t1.*__f;
// }
// forth bullet
-template <class _T1, class _R, bool>
+template <class _T1, class _Rp, bool>
struct __4th_helper
{
};
-template <class _T1, class _R>
-struct __4th_helper<_T1, _R, true>
+template <class _T1, class _Rp>
+struct __4th_helper<_T1, _Rp, true>
{
- typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
+ typedef typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _Rp>::type type;
};
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
-typename __4th_helper<_T1, _R,
- !is_base_of<_T,
+typename __4th_helper<_T1, _Rp,
+ !is_base_of<_Tp,
typename remove_reference<_T1>::type
>::value
>::type&
-__invoke(_R _T::* __f, _T1& __t1)
+__invoke(_Rp _Tp::* __f, _T1& __t1)
{
return (*__t1).*__f;
}
-// template <class _D, class _R, class _T, class _T1>
+// template <class _Dp, class _Rp, class _Tp, class _T1>
// inline _LIBCPP_INLINE_VISIBILITY
// typename enable_if
// <
-// !is_base_of<_T, typename remove_reference<_T1>::type>::value,
-// typename __ref_return1<_R _T::*, _T1>::type
+// !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+// typename __ref_return1<_Rp _Tp::*, _T1>::type
// >::type
-// __invoke(_R _T::* __f, _T1 __t1)
+// __invoke(_Rp _Tp::* __f, _T1 __t1)
// {
// return (*__t1).*__f;
// }
// fifth bullet
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_F>()())
-__invoke(_F __f)
+decltype(declval<_Fp>()())
+__invoke(_Fp __f)
{
return __f();
}
-template <class _F, class _A0>
+template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_F>()(declval<_A0&>()))
-__invoke(_F __f, _A0& __a0)
+decltype(declval<_Fp>()(declval<_A0&>()))
+__invoke(_Fp __f, _A0& __a0)
{
return __f(__a0);
}
-template <class _F, class _A0, class _A1>
+template <class _Fp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>()))
-__invoke(_F __f, _A0& __a0, _A1& __a1)
+decltype(declval<_Fp>()(declval<_A0&>(), declval<_A1&>()))
+__invoke(_Fp __f, _A0& __a0, _A1& __a1)
{
return __f(__a0, __a1);
}
-template <class _F, class _A0, class _A1, class _A2>
+template <class _Fp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
-__invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
+decltype(declval<_Fp>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
+__invoke(_Fp __f, _A0& __a0, _A1& __a1, _A2& __a2)
{
return __f(__a0, __a1, __a2);
}
-// template <class _R, class _F>
+// template <class _Rp, class _Fp>
// inline _LIBCPP_INLINE_VISIBILITY
-// _R
-// __invoke(_F& __f)
+// _Rp
+// __invoke(_Fp& __f)
// {
// return __f();
// }
//
-// template <class _R, class _F, class _A0>
+// template <class _Rp, class _Fp, class _A0>
// inline _LIBCPP_INLINE_VISIBILITY
// typename enable_if
// <
-// !is_member_pointer<_F>::value,
-// _R
+// !is_member_pointer<_Fp>::value,
+// _Rp
// >::type
-// __invoke(_F& __f, _A0& __a0)
+// __invoke(_Fp& __f, _A0& __a0)
// {
// return __f(__a0);
// }
//
-// template <class _R, class _F, class _A0, class _A1>
+// template <class _Rp, class _Fp, class _A0, class _A1>
// inline _LIBCPP_INLINE_VISIBILITY
-// _R
-// __invoke(_F& __f, _A0& __a0, _A1& __a1)
+// _Rp
+// __invoke(_Fp& __f, _A0& __a0, _A1& __a1)
// {
// return __f(__a0, __a1);
// }
//
-// template <class _R, class _F, class _A0, class _A1, class _A2>
+// template <class _Rp, class _Fp, class _A0, class _A1, class _A2>
// inline _LIBCPP_INLINE_VISIBILITY
-// _R
-// __invoke(_F& __f, _A0& __a0, _A1& __a1, _A2& __a2)
+// _Rp
+// __invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
// {
// return __f(__a0, __a1, __a2);
// }
struct __has_type
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::type* = 0);
public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
-template <class _F, bool = __has_result_type<__weak_result_type<_F> >::value>
+template <class _Fp, bool = __has_result_type<__weak_result_type<_Fp> >::value>
struct __invoke_return
{
- typedef typename __weak_result_type<_F>::result_type type;
+ typedef typename __weak_result_type<_Fp>::result_type type;
};
-template <class _F>
-struct __invoke_return<_F, false>
+template <class _Fp>
+struct __invoke_return<_Fp, false>
{
- typedef decltype(__invoke(_STD::declval<_F>())) type;
+ typedef decltype(__invoke(_VSTD::declval<_Fp>())) type;
};
template <class _Tp, class _A0>
struct __invoke_return0
{
- typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_A0>())) type;
+ typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>())) type;
};
-template <class _R, class _T, class _A0>
-struct __invoke_return0<_R _T::*, _A0>
+template <class _Rp, class _Tp, class _A0>
+struct __invoke_return0<_Rp _Tp::*, _A0>
{
- typedef typename __apply_cv<_A0, _R>::type& type;
+ typedef typename __apply_cv<_A0, _Rp>::type& type;
};
-template <class _R, class _T, class _A0>
-struct __invoke_return0<_R _T::*, _A0*>
+template <class _Rp, class _Tp, class _A0>
+struct __invoke_return0<_Rp _Tp::*, _A0*>
{
- typedef typename __apply_cv<_A0, _R>::type& type;
+ typedef typename __apply_cv<_A0, _Rp>::type& type;
};
template <class _Tp, class _A0, class _A1>
struct __invoke_return1
{
- typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_A0>(),
- _STD::declval<_A1>())) type;
+ typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>(),
+ _VSTD::declval<_A1>())) type;
};
template <class _Tp, class _A0, class _A1, class _A2>
struct __invoke_return2
{
- typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_A0>(),
- _STD::declval<_A1>(),
- _STD::declval<_A2>())) type;
+ typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>(),
+ _VSTD::declval<_A1>(),
+ _VSTD::declval<_A2>())) type;
};
template <class _Tp>
-class _LIBCPP_VISIBLE reference_wrapper
+class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
: public __weak_result_type<_Tp>
{
public:
typename __invoke_return0<type&, _A0>::type
operator() (_A0& __a0) const
{
- return __invoke(get(), __a0);
+ return __invoke<type&, _A0>(get(), __a0);
}
template <class _A0, class _A1>
typename __invoke_return1<type&, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const
{
- return __invoke(get(), __a0, __a1);
+ return __invoke<type&, _A0, _A1>(get(), __a0, __a1);
}
template <class _A0, class _A1, class _A2>
typename __invoke_return2<type&, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
{
- return __invoke(get(), __a0, __a1, __a2);
+ return __invoke<type&, _A0, _A1, _A2>(get(), __a0, __a1, __a2);
}
};
-template <class _Tp> struct ____is_reference_wrapper : public false_type {};
-template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
+template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
+template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
template <class _Tp> struct __is_reference_wrapper
- : public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
+ : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
#include <algorithm>
#include <cmath>
+#include <__undef_min_max>
+
+#ifdef _LIBCPP_DEBUG
+# include <__debug>
+#else
+# define _LIBCPP_ASSERT(x, m) ((void)0)
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
+#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_VISIBLE
-size_t __next_prime(size_t);
+_LIBCPP_FUNC_VIS
+size_t __next_prime(size_t __n);
template <class _NodePtr>
struct __hash_node_base
{
typedef __hash_node_base __first_node;
- typedef _NodePtr pointer;
- pointer __next_;
+ _NodePtr __next_;
- _LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
+ _LIBCPP_INLINE_VISIBILITY __hash_node_base() _NOEXCEPT : __next_(nullptr) {}
};
template <class _Tp, class _VoidPtr>
value_type __value_;
};
-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 _LIBCPP_VISIBLE unordered_map;
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+__is_power2(size_t __bc)
+{
+ return __bc > 2 && !(__bc & (__bc - 1));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+__constrain_hash(size_t __h, size_t __bc)
+{
+ return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : __h % __bc;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+__next_pow2(size_t __n)
+{
+ return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
+}
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
+template <class _ConstNodePtr> class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
+template <class _HashIterator> class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
+template <class _HashIterator> class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ class _LIBCPP_TYPE_VIS_ONLY unordered_map;
template <class _NodePtr>
-class _LIBCPP_VISIBLE __hash_iterator
+class _LIBCPP_TYPE_VIS_ONLY __hash_iterator
{
typedef _NodePtr __node_pointer;
#endif
pointer;
- _LIBCPP_INLINE_VISIBILITY __hash_iterator() {}
+ _LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+ : __node_(nullptr)
+#endif
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_i(this);
+#endif
+ }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return __node_->__value_;}
+ __hash_iterator(const __hash_iterator& __i)
+ : __node_(__i.__node_)
+ {
+ __get_db()->__iterator_copy(this, &__i);
+ }
+
_LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {return _STD::addressof(__node_->__value_);}
+ ~__hash_iterator()
+ {
+ __get_db()->__erase_i(this);
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ __hash_iterator& operator=(const __hash_iterator& __i)
+ {
+ if (this != &__i)
+ {
+ __get_db()->__iterator_copy(this, &__i);
+ __node_ = __i.__node_;
+ }
+ return *this;
+ }
+
+#endif // _LIBCPP_DEBUG_LEVEL >= 2
+
+ _LIBCPP_INLINE_VISIBILITY
+ reference operator*() const
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to dereference a non-dereferenceable unordered container iterator");
+#endif
+ return __node_->__value_;
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ pointer operator->() const
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to dereference a non-dereferenceable unordered container iterator");
+#endif
+ return pointer_traits<pointer>::pointer_to(__node_->__value_);
+ }
_LIBCPP_INLINE_VISIBILITY
__hash_iterator& operator++()
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to increment non-incrementable unordered container iterator");
+#endif
__node_ = __node_->__next_;
return *this;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
- {return __x.__node_ == __y.__node_;}
+ {
+ return __x.__node_ == __y.__node_;
+ }
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
- {return __x.__node_ != __y.__node_;}
+ {return !(__x == __y);}
private:
+#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
- __hash_iterator(__node_pointer __node)
+ __hash_iterator(__node_pointer __node, const void* __c) _NOEXCEPT
+ : __node_(__node)
+ {
+ __get_db()->__insert_ic(this, __c);
+ }
+#else
+ _LIBCPP_INLINE_VISIBILITY
+ __hash_iterator(__node_pointer __node) _NOEXCEPT
: __node_(__node)
{}
+#endif
template <class, class, class, class> friend class __hash_table;
- 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> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
+ template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
+ template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_map;
+ template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_multimap;
};
template <class _ConstNodePtr>
-class _LIBCPP_VISIBLE __hash_const_iterator
+class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator
{
typedef _ConstNodePtr __node_pointer;
__non_const_node_pointer;
typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator;
- _LIBCPP_INLINE_VISIBILITY __hash_const_iterator() {}
+ _LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT
+#if _LIBCPP_STD_VER > 11
+ : __node_(nullptr)
+#endif
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_i(this);
+#endif
+ }
_LIBCPP_INLINE_VISIBILITY
- __hash_const_iterator(const __non_const_iterator& __x)
+ __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
: __node_(__x.__node_)
- {}
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__iterator_copy(this, &__x);
+#endif
+ }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+ _LIBCPP_INLINE_VISIBILITY
+ __hash_const_iterator(const __hash_const_iterator& __i)
+ : __node_(__i.__node_)
+ {
+ __get_db()->__iterator_copy(this, &__i);
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ ~__hash_const_iterator()
+ {
+ __get_db()->__erase_i(this);
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ __hash_const_iterator& operator=(const __hash_const_iterator& __i)
+ {
+ if (this != &__i)
+ {
+ __get_db()->__iterator_copy(this, &__i);
+ __node_ = __i.__node_;
+ }
+ return *this;
+ }
+
+#endif // _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return __node_->__value_;}
+ reference operator*() const
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+#endif
+ return __node_->__value_;
+ }
_LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {return _STD::addressof(__node_->__value_);}
+ pointer operator->() const
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+#endif
+ return pointer_traits<pointer>::pointer_to(__node_->__value_);
+ }
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator& operator++()
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to increment non-incrementable unordered container const_iterator");
+#endif
__node_ = __node_->__next_;
return *this;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
- {return __x.__node_ == __y.__node_;}
+ {
+ return __x.__node_ == __y.__node_;
+ }
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
- {return __x.__node_ != __y.__node_;}
+ {return !(__x == __y);}
private:
+#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
- __hash_const_iterator(__node_pointer __node)
+ __hash_const_iterator(__node_pointer __node, const void* __c) _NOEXCEPT
+ : __node_(__node)
+ {
+ __get_db()->__insert_ic(this, __c);
+ }
+#else
+ _LIBCPP_INLINE_VISIBILITY
+ __hash_const_iterator(__node_pointer __node) _NOEXCEPT
: __node_(__node)
{}
+#endif
template <class, class, class, class> friend class __hash_table;
- 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> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
+ template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_map;
+ template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_multimap;
};
-template <class> class _LIBCPP_VISIBLE __hash_const_local_iterator;
+template <class _ConstNodePtr> class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
template <class _NodePtr>
-class _LIBCPP_VISIBLE __hash_local_iterator
+class _LIBCPP_TYPE_VIS_ONLY __hash_local_iterator
{
typedef _NodePtr __node_pointer;
#endif
pointer;
- _LIBCPP_INLINE_VISIBILITY __hash_local_iterator() {}
+ _LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_i(this);
+#endif
+ }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return __node_->__value_;}
+ __hash_local_iterator(const __hash_local_iterator& __i)
+ : __node_(__i.__node_),
+ __bucket_(__i.__bucket_),
+ __bucket_count_(__i.__bucket_count_)
+ {
+ __get_db()->__iterator_copy(this, &__i);
+ }
+
_LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {return &__node_->__value_;}
+ ~__hash_local_iterator()
+ {
+ __get_db()->__erase_i(this);
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ __hash_local_iterator& operator=(const __hash_local_iterator& __i)
+ {
+ if (this != &__i)
+ {
+ __get_db()->__iterator_copy(this, &__i);
+ __node_ = __i.__node_;
+ __bucket_ = __i.__bucket_;
+ __bucket_count_ = __i.__bucket_count_;
+ }
+ return *this;
+ }
+
+#endif // _LIBCPP_DEBUG_LEVEL >= 2
+
+ _LIBCPP_INLINE_VISIBILITY
+ reference operator*() const
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to dereference a non-dereferenceable unordered container local_iterator");
+#endif
+ return __node_->__value_;
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ pointer operator->() const
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to dereference a non-dereferenceable unordered container local_iterator");
+#endif
+ return pointer_traits<pointer>::pointer_to(__node_->__value_);
+ }
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator& operator++()
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to increment non-incrementable unordered container local_iterator");
+#endif
__node_ = __node_->__next_;
- if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
+ if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
__node_ = nullptr;
return *this;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
- {return __x.__node_ == __y.__node_;}
+ {
+ return __x.__node_ == __y.__node_;
+ }
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
- {return __x.__node_ != __y.__node_;}
+ {return !(__x == __y);}
private:
+#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator(__node_pointer __node, size_t __bucket,
- size_t __bucket_count)
+ size_t __bucket_count, const void* __c) _NOEXCEPT
: __node_(__node),
__bucket_(__bucket),
__bucket_count_(__bucket_count)
{
+ __get_db()->__insert_ic(this, __c);
if (__node_ != nullptr)
__node_ = __node_->__next_;
}
-
+#else
+ _LIBCPP_INLINE_VISIBILITY
+ __hash_local_iterator(__node_pointer __node, size_t __bucket,
+ size_t __bucket_count) _NOEXCEPT
+ : __node_(__node),
+ __bucket_(__bucket),
+ __bucket_count_(__bucket_count)
+ {
+ if (__node_ != nullptr)
+ __node_ = __node_->__next_;
+ }
+#endif
template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
- template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
+ template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
+ template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
};
template <class _ConstNodePtr>
-class _LIBCPP_VISIBLE __hash_const_local_iterator
+class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator
{
typedef _ConstNodePtr __node_pointer;
#endif
pointer;
- _LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() {}
+ _LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_i(this);
+#endif
+ }
+
_LIBCPP_INLINE_VISIBILITY
- __hash_const_local_iterator(const __non_const_iterator& __x)
+ __hash_const_local_iterator(const __non_const_iterator& __x) _NOEXCEPT
: __node_(__x.__node_),
__bucket_(__x.__bucket_),
__bucket_count_(__x.__bucket_count_)
- {}
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__iterator_copy(this, &__x);
+#endif
+ }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+ _LIBCPP_INLINE_VISIBILITY
+ __hash_const_local_iterator(const __hash_const_local_iterator& __i)
+ : __node_(__i.__node_),
+ __bucket_(__i.__bucket_),
+ __bucket_count_(__i.__bucket_count_)
+ {
+ __get_db()->__iterator_copy(this, &__i);
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ ~__hash_const_local_iterator()
+ {
+ __get_db()->__erase_i(this);
+ }
_LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return __node_->__value_;}
+ __hash_const_local_iterator& operator=(const __hash_const_local_iterator& __i)
+ {
+ if (this != &__i)
+ {
+ __get_db()->__iterator_copy(this, &__i);
+ __node_ = __i.__node_;
+ __bucket_ = __i.__bucket_;
+ __bucket_count_ = __i.__bucket_count_;
+ }
+ return *this;
+ }
+
+#endif // _LIBCPP_DEBUG_LEVEL >= 2
+
_LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {return &__node_->__value_;}
+ reference operator*() const
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+#endif
+ return __node_->__value_;
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ pointer operator->() const
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+#endif
+ return pointer_traits<pointer>::pointer_to(__node_->__value_);
+ }
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator& operator++()
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
+ "Attempted to increment non-incrementable unordered container const_local_iterator");
+#endif
__node_ = __node_->__next_;
- if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
+ if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
__node_ = nullptr;
return *this;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
- {return __x.__node_ == __y.__node_;}
+ {
+ return __x.__node_ == __y.__node_;
+ }
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
- {return __x.__node_ != __y.__node_;}
+ {return !(__x == __y);}
private:
+#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator(__node_pointer __node, size_t __bucket,
- size_t __bucket_count)
+ size_t __bucket_count, const void* __c) _NOEXCEPT
: __node_(__node),
__bucket_(__bucket),
__bucket_count_(__bucket_count)
{
+ __get_db()->__insert_ic(this, __c);
if (__node_ != nullptr)
__node_ = __node_->__next_;
}
-
+#else
+ _LIBCPP_INLINE_VISIBILITY
+ __hash_const_local_iterator(__node_pointer __node, size_t __bucket,
+ size_t __bucket_count) _NOEXCEPT
+ : __node_(__node),
+ __bucket_(__bucket),
+ __bucket_count_(__bucket_count)
+ {
+ if (__node_ != nullptr)
+ __node_ = __node_->__next_;
+ }
+#endif
template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
+ template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
};
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator()
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __data_(0) {}
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(const allocator_type& __a, size_type __size)
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
: __data_(__size, __a) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
- : __data_(_STD::move(__x.__data_))
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+ : __data_(_VSTD::move(__x.__data_))
{
__x.size() = 0;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY size_type& size() {return __data_.first();}
- _LIBCPP_INLINE_VISIBILITY size_type size() const {return __data_.first();}
+ _LIBCPP_INLINE_VISIBILITY
+ size_type& size() _NOEXCEPT {return __data_.first();}
+ _LIBCPP_INLINE_VISIBILITY
+ size_type size() const _NOEXCEPT {return __data_.first();}
- _LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __data_.second();}
- _LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __data_.second();}
+ _LIBCPP_INLINE_VISIBILITY
+ allocator_type& __alloc() _NOEXCEPT {return __data_.second();}
+ _LIBCPP_INLINE_VISIBILITY
+ const allocator_type& __alloc() const _NOEXCEPT {return __data_.second();}
_LIBCPP_INLINE_VISIBILITY
- void operator()(pointer __p)
+ void operator()(pointer __p) _NOEXCEPT
{
__alloc_traits::deallocate(__alloc(), __p, size());
}
};
-template <class> class __hash_map_node_destructor;
+template <class _Alloc> class __hash_map_node_destructor;
template <class _Alloc>
class __hash_node_destructor
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
- explicit __hash_node_destructor(allocator_type& __na)
+ explicit __hash_node_destructor(allocator_type& __na,
+ bool __constructed = false) _NOEXCEPT
: __na_(__na),
- __value_constructed(false)
+ __value_constructed(__constructed)
{}
_LIBCPP_INLINE_VISIBILITY
- void operator()(pointer __p)
+ void operator()(pointer __p) _NOEXCEPT
{
if (__value_constructed)
- __alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
+ __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
public:
// Create __node
typedef __hash_node<value_type, typename __alloc_traits::void_pointer> __node;
- typedef typename __node::__first_node __first_node;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
__node_allocator;
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
- typedef typename __node_traits::const_pointer __node_const_pointer;
+ typedef typename __node_traits::pointer __node_const_pointer;
+ typedef __hash_node_base<__node_pointer> __first_node;
+ typedef typename pointer_traits<__node_pointer>::template
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+ rebind<__first_node>
+#else
+ rebind<__first_node>::other
+#endif
+ __node_base_pointer;
private:
__compressed_pair<float, key_equal> __p3_;
// --- Member data end ---
- _LIBCPP_INLINE_VISIBILITY size_type& size() {return __p2_.first();}
+ _LIBCPP_INLINE_VISIBILITY
+ size_type& size() _NOEXCEPT {return __p2_.first();}
public:
- _LIBCPP_INLINE_VISIBILITY size_type size() const {return __p2_.first();}
+ _LIBCPP_INLINE_VISIBILITY
+ size_type size() const _NOEXCEPT {return __p2_.first();}
- _LIBCPP_INLINE_VISIBILITY hasher& hash_function() {return __p2_.second();}
- _LIBCPP_INLINE_VISIBILITY const hasher& hash_function() const {return __p2_.second();}
+ _LIBCPP_INLINE_VISIBILITY
+ hasher& hash_function() _NOEXCEPT {return __p2_.second();}
+ _LIBCPP_INLINE_VISIBILITY
+ const hasher& hash_function() const _NOEXCEPT {return __p2_.second();}
- _LIBCPP_INLINE_VISIBILITY float& max_load_factor() {return __p3_.first();}
- _LIBCPP_INLINE_VISIBILITY float max_load_factor() const {return __p3_.first();}
+ _LIBCPP_INLINE_VISIBILITY
+ float& max_load_factor() _NOEXCEPT {return __p3_.first();}
+ _LIBCPP_INLINE_VISIBILITY
+ float max_load_factor() const _NOEXCEPT {return __p3_.first();}
- _LIBCPP_INLINE_VISIBILITY key_equal& key_eq() {return __p3_.second();}
- _LIBCPP_INLINE_VISIBILITY const key_equal& key_eq() const {return __p3_.second();}
+ _LIBCPP_INLINE_VISIBILITY
+ key_equal& key_eq() _NOEXCEPT {return __p3_.second();}
+ _LIBCPP_INLINE_VISIBILITY
+ const key_equal& key_eq() const _NOEXCEPT {return __p3_.second();}
- _LIBCPP_INLINE_VISIBILITY __node_allocator& __node_alloc() {return __p1_.second();}
- _LIBCPP_INLINE_VISIBILITY const __node_allocator& __node_alloc() const {return __p1_.second();}
+ _LIBCPP_INLINE_VISIBILITY
+ __node_allocator& __node_alloc() _NOEXCEPT {return __p1_.second();}
+ _LIBCPP_INLINE_VISIBILITY
+ const __node_allocator& __node_alloc() const _NOEXCEPT
+ {return __p1_.second();}
public:
typedef __hash_iterator<__node_pointer> iterator;
- typedef __hash_const_iterator<__node_const_pointer> const_iterator;
+ typedef __hash_const_iterator<__node_pointer> const_iterator;
typedef __hash_local_iterator<__node_pointer> local_iterator;
- typedef __hash_const_local_iterator<__node_const_pointer> const_local_iterator;
-
- __hash_table();
+ typedef __hash_const_local_iterator<__node_pointer> const_local_iterator;
+
+ __hash_table()
+ _NOEXCEPT_(
+ is_nothrow_default_constructible<__bucket_list>::value &&
+ is_nothrow_default_constructible<__first_node>::value &&
+ is_nothrow_default_constructible<__node_allocator>::value &&
+ is_nothrow_default_constructible<hasher>::value &&
+ is_nothrow_default_constructible<key_equal>::value);
__hash_table(const hasher& __hf, const key_equal& __eql);
__hash_table(const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
__hash_table(const __hash_table& __u);
__hash_table(const __hash_table& __u, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- __hash_table(__hash_table&& __u);
+ __hash_table(__hash_table&& __u)
+ _NOEXCEPT_(
+ is_nothrow_move_constructible<__bucket_list>::value &&
+ is_nothrow_move_constructible<__first_node>::value &&
+ is_nothrow_move_constructible<__node_allocator>::value &&
+ is_nothrow_move_constructible<hasher>::value &&
+ is_nothrow_move_constructible<key_equal>::value);
__hash_table(__hash_table&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~__hash_table();
__hash_table& operator=(const __hash_table& __u);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- __hash_table& operator=(__hash_table&& __u);
+ __hash_table& operator=(__hash_table&& __u)
+ _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value &&
+ is_nothrow_move_assignable<__node_allocator>::value &&
+ is_nothrow_move_assignable<hasher>::value &&
+ is_nothrow_move_assignable<key_equal>::value);
#endif
template <class _InputIterator>
void __assign_unique(_InputIterator __first, _InputIterator __last);
void __assign_multi(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
- size_type max_size() const
+ size_type max_size() const _NOEXCEPT
{
return allocator_traits<__pointer_allocator>::max_size(
__bucket_list_.get_deleter().__alloc());
pair<iterator, bool> __insert_unique(const value_type& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P>
- pair<iterator, bool> __insert_unique(_P&& __x);
+ template <class _Pp>
+ pair<iterator, bool> __insert_unique(_Pp&& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P>
- iterator __insert_multi(_P&& __x);
- template <class _P>
- iterator __insert_multi(const_iterator __p, _P&& __x);
+ template <class _Pp>
+ iterator __insert_multi(_Pp&& __x);
+ template <class _Pp>
+ iterator __insert_multi(const_iterator __p, _Pp&& __x);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
iterator __insert_multi(const value_type& __x);
iterator __insert_multi(const_iterator __p, const value_type& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void clear();
+ void clear() _NOEXCEPT;
void rehash(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
+ size_type bucket_count() const _NOEXCEPT
{
return __bucket_list_.get_deleter().size();
}
- iterator begin();
- iterator end();
- const_iterator begin() const;
- const_iterator end() const;
+ iterator begin() _NOEXCEPT;
+ iterator end() _NOEXCEPT;
+ const_iterator begin() const _NOEXCEPT;
+ const_iterator end() const _NOEXCEPT;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const _Key& __k) const
- {return hash_function()(__k) % bucket_count();}
+ {
+ _LIBCPP_ASSERT(bucket_count() > 0,
+ "unordered container::bucket(key) called when bucket_count() == 0");
+ return __constrain_hash(hash_function()(__k), bucket_count());
+ }
template <class _Key>
iterator find(const _Key& __x);
template <class _Key>
const_iterator find(const _Key& __x) const;
- typedef __hash_node_destructor<__node_allocator> _D;
- typedef unique_ptr<__node, _D> __node_holder;
+ typedef __hash_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
iterator erase(const_iterator __p);
iterator erase(const_iterator __first, const_iterator __last);
size_type __erase_unique(const _Key& __k);
template <class _Key>
size_type __erase_multi(const _Key& __k);
- __node_holder remove(const_iterator __p);
+ __node_holder remove(const_iterator __p) _NOEXCEPT;
template <class _Key>
size_type __count_unique(const _Key& __k) const;
pair<const_iterator, const_iterator>
__equal_range_multi(const _Key& __k) const;
- void swap(__hash_table& __u);
+ void swap(__hash_table& __u)
+ _NOEXCEPT_(
+ (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__pointer_allocator>::value) &&
+ (!__node_traits::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__node_allocator>::value) &&
+ __is_nothrow_swappable<hasher>::value &&
+ __is_nothrow_swappable<key_equal>::value);
_LIBCPP_INLINE_VISIBILITY
- size_type max_bucket_count() const
- {return __bucket_list_.get_deleter().__alloc().max_size();}
+ size_type max_bucket_count() const _NOEXCEPT
+ {return __pointer_alloc_traits::max_size(__bucket_list_.get_deleter().__alloc());}
size_type bucket_size(size_type __n) const;
- _LIBCPP_INLINE_VISIBILITY float load_factor() const
+ _LIBCPP_INLINE_VISIBILITY float load_factor() const _NOEXCEPT
{
size_type __bc = bucket_count();
return __bc != 0 ? (float)size() / __bc : 0.f;
}
- _LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf)
- {max_load_factor() = _STD::max(__mlf, load_factor());}
-
- _LIBCPP_INLINE_VISIBILITY local_iterator begin(size_type __n)
- {return local_iterator(__bucket_list_[__n], __n, bucket_count());}
- _LIBCPP_INLINE_VISIBILITY local_iterator end(size_type __n)
- {return local_iterator(nullptr, __n, bucket_count());}
- _LIBCPP_INLINE_VISIBILITY const_local_iterator cbegin(size_type __n) const
- {return const_local_iterator(__bucket_list_[__n], __n, bucket_count());}
- _LIBCPP_INLINE_VISIBILITY const_local_iterator cend(size_type __n) const
- {return const_local_iterator(nullptr, __n, bucket_count());}
+ _LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf) _NOEXCEPT
+ {
+ _LIBCPP_ASSERT(__mlf > 0,
+ "unordered container::max_load_factor(lf) called with lf <= 0");
+ max_load_factor() = _VSTD::max(__mlf, load_factor());
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ local_iterator
+ begin(size_type __n)
+ {
+ _LIBCPP_ASSERT(__n < bucket_count(),
+ "unordered container::begin(n) called with n >= bucket_count()");
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
+#else
+ return local_iterator(__bucket_list_[__n], __n, bucket_count());
+#endif
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ local_iterator
+ end(size_type __n)
+ {
+ _LIBCPP_ASSERT(__n < bucket_count(),
+ "unordered container::end(n) called with n >= bucket_count()");
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return local_iterator(nullptr, __n, bucket_count(), this);
+#else
+ return local_iterator(nullptr, __n, bucket_count());
+#endif
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ const_local_iterator
+ cbegin(size_type __n) const
+ {
+ _LIBCPP_ASSERT(__n < bucket_count(),
+ "unordered container::cbegin(n) called with n >= bucket_count()");
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
+#else
+ return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
+#endif
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ const_local_iterator
+ cend(size_type __n) const
+ {
+ _LIBCPP_ASSERT(__n < bucket_count(),
+ "unordered container::cend(n) called with n >= bucket_count()");
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return const_local_iterator(nullptr, __n, bucket_count(), this);
+#else
+ return const_local_iterator(nullptr, __n, bucket_count());
+#endif
+ }
+
+#if _LIBCPP_DEBUG_LEVEL >= 2
+
+ bool __dereferenceable(const const_iterator* __i) const;
+ bool __decrementable(const const_iterator* __i) const;
+ bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
+ bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
+
+#endif // _LIBCPP_DEBUG_LEVEL >= 2
+
private:
void __rehash(size_type __n);
__node_traits::propagate_on_container_copy_assignment::value>());}
void __copy_assign_alloc(const __hash_table& __u, true_type);
_LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const __hash_table& __u, false_type) {}
+ void __copy_assign_alloc(const __hash_table&, false_type) {}
void __move_assign(__hash_table& __u, false_type);
- void __move_assign(__hash_table& __u, true_type);
- _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__hash_table& __u)
+ void __move_assign(__hash_table& __u, true_type)
+ _NOEXCEPT_(
+ is_nothrow_move_assignable<__node_allocator>::value &&
+ is_nothrow_move_assignable<hasher>::value &&
+ is_nothrow_move_assignable<key_equal>::value);
+ _LIBCPP_INLINE_VISIBILITY
+ void __move_assign_alloc(__hash_table& __u)
+ _NOEXCEPT_(
+ !__node_traits::propagate_on_container_move_assignment::value ||
+ (is_nothrow_move_assignable<__pointer_allocator>::value &&
+ is_nothrow_move_assignable<__node_allocator>::value))
{__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)
+ _NOEXCEPT_(
+ is_nothrow_move_assignable<__pointer_allocator>::value &&
+ is_nothrow_move_assignable<__node_allocator>::value)
{
__bucket_list_.get_deleter().__alloc() =
- _STD::move(__u.__bucket_list_.get_deleter().__alloc());
- __node_alloc() = _STD::move(__u.__node_alloc());
+ _VSTD::move(__u.__bucket_list_.get_deleter().__alloc());
+ __node_alloc() = _VSTD::move(__u.__node_alloc());
}
_LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__hash_table&, false_type) {}
+ void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
- template <class _A>
+ template <class _Ap>
_LIBCPP_INLINE_VISIBILITY
static
void
- __swap_alloc(_A& __x, _A& __y)
+ __swap_alloc(_Ap& __x, _Ap& __y)
+ _NOEXCEPT_(
+ !allocator_traits<_Ap>::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<_Ap>::value)
{
__swap_alloc(__x, __y,
integral_constant<bool,
- allocator_traits<_A>::propagate_on_container_swap::value
+ allocator_traits<_Ap>::propagate_on_container_swap::value
>());
}
- template <class _A>
+ template <class _Ap>
_LIBCPP_INLINE_VISIBILITY
static
void
- __swap_alloc(_A& __x, _A& __y, true_type)
+ __swap_alloc(_Ap& __x, _Ap& __y, true_type)
+ _NOEXCEPT_(__is_nothrow_swappable<_Ap>::value)
{
- using _STD::swap;
+ using _VSTD::swap;
swap(__x, __y);
}
- template <class _A>
+ template <class _Ap>
_LIBCPP_INLINE_VISIBILITY
static
void
- __swap_alloc(_A& __x, _A& __y, false_type) {}
+ __swap_alloc(_Ap&, _Ap&, false_type) _NOEXCEPT {}
+
+ void __deallocate(__node_pointer __np) _NOEXCEPT;
+ __node_pointer __detach() _NOEXCEPT;
- void __deallocate(__node_pointer __np);
- __node_pointer __detach();
+ template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_map;
+ template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY unordered_multimap;
};
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
+ _NOEXCEPT_(
+ is_nothrow_default_constructible<__bucket_list>::value &&
+ is_nothrow_default_constructible<__first_node>::value &&
+ is_nothrow_default_constructible<hasher>::value &&
+ is_nothrow_default_constructible<key_equal>::value)
: __p2_(0),
__p3_(1.0f)
{
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
- : __bucket_list_(_STD::move(__u.__bucket_list_)),
- __p1_(_STD::move(__u.__p1_)),
- __p2_(_STD::move(__u.__p2_)),
- __p3_(_STD::move(__u.__p3_))
+ _NOEXCEPT_(
+ is_nothrow_move_constructible<__bucket_list>::value &&
+ is_nothrow_move_constructible<__first_node>::value &&
+ is_nothrow_move_constructible<hasher>::value &&
+ is_nothrow_move_constructible<key_equal>::value)
+ : __bucket_list_(_VSTD::move(__u.__bucket_list_)),
+ __p1_(_VSTD::move(__u.__p1_)),
+ __p2_(_VSTD::move(__u.__p2_)),
+ __p3_(_VSTD::move(__u.__p3_))
{
if (size() > 0)
{
- __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
- static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
+ __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
+ static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__node_allocator(__a)),
- __p2_(0, _STD::move(__u.hash_function())),
- __p3_(_STD::move(__u.__p3_))
+ __p2_(0, _VSTD::move(__u.hash_function())),
+ __p3_(_VSTD::move(__u.__p3_))
{
if (__a == allocator_type(__u.__node_alloc()))
{
{
__p1_.first().__next_ = __u.__p1_.first().__next_;
__u.__p1_.first().__next_ = nullptr;
- __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
- static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
+ __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
+ static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
size() = __u.size();
__u.size() = 0;
}
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
{
__deallocate(__p1_.first().__next_);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__erase_c(this);
+#endif
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__node_pointer __np)
+ _NOEXCEPT
{
__node_allocator& __na = __node_alloc();
while (__np != nullptr)
{
__node_pointer __next = __np->__next_;
- __node_traits::destroy(__na, _STD::addressof(__np->__value_));
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __c_node* __c = __get_db()->__find_c_and_lock(this);
+ for (__i_node** __p = __c->end_; __p != __c->beg_; )
+ {
+ --__p;
+ iterator* __i = static_cast<iterator*>((*__p)->__i_);
+ if (__i->__node_ == __np)
+ {
+ (*__p)->__c_ = nullptr;
+ if (--__c->end_ != __p)
+ memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+ }
+ }
+ __get_db()->unlock();
+#endif
+ __node_traits::destroy(__na, _VSTD::addressof(__np->__value_));
__node_traits::deallocate(__na, __np, 1);
__np = __next;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_pointer
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach()
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT
{
size_type __bc = bucket_count();
for (size_type __i = 0; __i < __bc; ++__i)
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__hash_table& __u, true_type)
+ _NOEXCEPT_(
+ is_nothrow_move_assignable<__node_allocator>::value &&
+ is_nothrow_move_assignable<hasher>::value &&
+ is_nothrow_move_assignable<key_equal>::value)
{
clear();
__bucket_list_.reset(__u.__bucket_list_.release());
__u.__bucket_list_.get_deleter().size() = 0;
__move_assign_alloc(__u);
size() = __u.size();
- hash_function() = _STD::move(__u.hash_function());
+ hash_function() = _VSTD::move(__u.hash_function());
max_load_factor() = __u.max_load_factor();
- key_eq() = _STD::move(__u.key_eq());
+ key_eq() = _VSTD::move(__u.key_eq());
__p1_.first().__next_ = __u.__p1_.first().__next_;
if (size() > 0)
{
- __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
- static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
+ __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
+ static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->swap(this, &__u);
+#endif
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__move_assign(__u, true_type());
else
{
- hash_function() = _STD::move(__u.hash_function());
- key_eq() = _STD::move(__u.key_eq());
+ hash_function() = _VSTD::move(__u.hash_function());
+ key_eq() = _VSTD::move(__u.key_eq());
max_load_factor() = __u.max_load_factor();
if (bucket_count() != 0)
{
const_iterator __i = __u.begin();
while (__cache != nullptr && __u.size() != 0)
{
- __cache->__value_ = _STD::move(__u.remove(__i++)->__value_);
+ __cache->__value_ = _VSTD::move(__u.remove(__i++)->__value_);
__node_pointer __next = __cache->__next_;
__node_insert_multi(__cache);
__cache = __next;
while (__u.size() != 0)
{
__node_holder __h =
- __construct_node(_STD::move(__u.remove(__i++)->__value_));
+ __construct_node(_VSTD::move(__u.remove(__i++)->__value_));
__node_insert_multi(__h.get());
__h.release();
}
inline _LIBCPP_INLINE_VISIBILITY
__hash_table<_Tp, _Hash, _Equal, _Alloc>&
__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
+ _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value &&
+ is_nothrow_move_assignable<__node_allocator>::value &&
+ is_nothrow_move_assignable<hasher>::value &&
+ is_nothrow_move_assignable<key_equal>::value)
{
__move_assign(__u, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin()
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return iterator(__p1_.first().__next_, this);
+#else
return iterator(__p1_.first().__next_);
+#endif
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::end()
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return iterator(nullptr, this);
+#else
return iterator(nullptr);
+#endif
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return const_iterator(__p1_.first().__next_, this);
+#else
return const_iterator(__p1_.first().__next_);
+#endif
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return const_iterator(nullptr, this);
+#else
return const_iterator(nullptr);
+#endif
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::clear()
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT
{
if (size() > 0)
{
__deallocate(__p1_.first().__next_);
__p1_.first().__next_ = nullptr;
size_type __bc = bucket_count();
- for (size_type __i; __i < __bc; ++__i)
+ for (size_type __i = 0; __i < __bc; ++__i)
__bucket_list_[__i] = nullptr;
size() = 0;
}
size_t __chash;
if (__bc != 0)
{
- __chash = __nd->__hash_ % __bc;
+ __chash = __constrain_hash(__nd->__hash_, __bc);
__ndptr = __bucket_list_[__chash];
if (__ndptr != nullptr)
{
for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
- __ndptr->__hash_ % __bc == __chash;
+ __constrain_hash(__ndptr->__hash_, __bc) == __chash;
__ndptr = __ndptr->__next_)
{
if (key_eq()(__ndptr->__value_, __nd->__value_))
{
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- rehash(_STD::max<size_type>(2 * __bc + 1,
+ rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
- __chash = __nd->__hash_ % __bc;
+ __chash = __constrain_hash(__nd->__hash_, __bc);
}
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
- __pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
+ __pn = static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
__nd->__next_ = __pn->__next_;
__pn->__next_ = __nd;
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__nd->__next_ != nullptr)
- __bucket_list_[__nd->__next_->__hash_ % __bc] = __nd;
+ __bucket_list_[__constrain_hash(__nd->__next_->__hash_, __bc)] = __nd;
}
else
{
__inserted = true;
}
__done:
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return pair<iterator, bool>(iterator(__ndptr, this), __inserted);
+#else
return pair<iterator, bool>(iterator(__ndptr), __inserted);
+#endif
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- rehash(_STD::max<size_type>(2 * __bc + 1,
+ rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
- size_t __chash = __cp->__hash_ % __bc;
+ size_t __chash = __constrain_hash(__cp->__hash_, __bc);
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
- __pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
+ __pn = static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
__cp->__next_ = __pn->__next_;
__pn->__next_ = __cp;
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__cp->__next_ != nullptr)
- __bucket_list_[__cp->__next_->__hash_ % __bc] = __cp;
+ __bucket_list_[__constrain_hash(__cp->__next_->__hash_, __bc)] = __cp;
}
else
{
for (bool __found = false; __pn->__next_ != nullptr &&
- __pn->__next_->__hash_ % __bc == __chash;
+ __constrain_hash(__pn->__next_->__hash_, __bc) == __chash;
__pn = __pn->__next_)
{
// __found key_eq() action
__pn->__next_ = __cp;
if (__cp->__next_ != nullptr)
{
- size_t __nhash = __cp->__next_->__hash_ % __bc;
+ size_t __nhash = __constrain_hash(__cp->__next_->__hash_, __bc);
if (__nhash != __chash)
__bucket_list_[__nhash] = __cp;
}
}
++size();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return iterator(__cp, this);
+#else
return iterator(__cp);
+#endif
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
const_iterator __p, __node_pointer __cp)
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+ "unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
+ " referring to this unordered container");
+#endif
if (__p != end() && key_eq()(*__p, __cp->__value_))
{
- __node_pointer __np = const_cast<__node_pointer>(__p.__node_);
+ __node_pointer __np = __p.__node_;
__cp->__hash_ = __np->__hash_;
size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- rehash(_STD::max<size_type>(2 * __bc + 1,
+ rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
- size_t __chash = __cp->__hash_ % __bc;
+ size_t __chash = __constrain_hash(__cp->__hash_, __bc);
__node_pointer __pp = __bucket_list_[__chash];
while (__pp->__next_ != __np)
__pp = __pp->__next_;
__cp->__next_ = __np;
__pp->__next_ = __cp;
++size();
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return iterator(__cp, this);
+#else
return iterator(__cp);
+#endif
}
return __node_insert_multi(__cp);
}
size_t __chash;
if (__bc != 0)
{
- __chash = __hash % __bc;
+ __chash = __constrain_hash(__hash, __bc);
__nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
- __nd->__hash_ % __bc == __chash;
+ __constrain_hash(__nd->__hash_, __bc) == __chash;
__nd = __nd->__next_)
{
if (key_eq()(__nd->__value_, __x))
__node_holder __h = __construct_node(__x, __hash);
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- rehash(_STD::max<size_type>(2 * __bc + 1,
+ rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
- __chash = __hash % __bc;
+ __chash = __constrain_hash(__hash, __bc);
}
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
- __pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
+ __pn = static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()));
__h->__next_ = __pn->__next_;
__pn->__next_ = __h.get();
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__h->__next_ != nullptr)
- __bucket_list_[__h->__next_->__hash_ % __bc] = __h.get();
+ __bucket_list_[__constrain_hash(__h->__next_->__hash_, __bc)] = __h.get();
}
else
{
__inserted = true;
}
__done:
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return pair<iterator, bool>(iterator(__nd, this), __inserted);
+#else
return pair<iterator, bool>(iterator(__nd), __inserted);
+#endif
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique(_Args&&... __args)
{
- __node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args)
{
- __node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __node_insert_multi(__h.get());
__h.release();
return __r;
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
const_iterator __p, _Args&&... __args)
{
- __node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+ "unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
+ " referring to this unordered container");
+#endif
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __node_insert_multi(__p, __h.get());
__h.release();
return __r;
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _P>
+template <class _Pp>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_Pp&& __x)
{
- __node_holder __h = __construct_node(_STD::forward<_P>(__x));
+ __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _P>
+template <class _Pp>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_P&& __x)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_Pp&& __x)
{
- __node_holder __h = __construct_node(_STD::forward<_P>(__x));
+ __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
iterator __r = __node_insert_multi(__h.get());
__h.release();
return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _P>
+template <class _Pp>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
- _P&& __x)
+ _Pp&& __x)
{
- __node_holder __h = __construct_node(_STD::forward<_P>(__x));
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+ "unordered container::insert(const_iterator, rvalue) called with an iterator not"
+ " referring to this unordered container");
+#endif
+ __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
iterator __r = __node_insert_multi(__p, __h.get());
__h.release();
return __r;
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
const value_type& __x)
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+ "unordered container::insert(const_iterator, lvalue) called with an iterator not"
+ " referring to this unordered container");
+#endif
__node_holder __h = __construct_node(__x);
iterator __r = __node_insert_multi(__p, __h.get());
__h.release();
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
{
- __n = __next_prime(_STD::max<size_type>(__n, size() > 0));
+ if (__n == 1)
+ __n = 2;
+ else if (__n & (__n - 1))
+ __n = __next_prime(__n);
size_type __bc = bucket_count();
if (__n > __bc)
__rehash(__n);
- else
+ else if (__n < __bc)
{
- __n = _STD::max<size_type>
+ __n = _VSTD::max<size_type>
(
__n,
- __next_prime(size_t(ceil(float(size()) / max_load_factor())))
+ __is_power2(__bc) ? __next_pow2(size_t(ceil(float(size()) / max_load_factor()))) :
+ __next_prime(size_t(ceil(float(size()) / max_load_factor())))
);
if (__n < __bc)
__rehash(__n);
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__invalidate_all(this);
+#endif // _LIBCPP_DEBUG_LEVEL >= 2
__pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
__bucket_list_.reset(__nbc > 0 ?
__pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
{
for (size_type __i = 0; __i < __nbc; ++__i)
__bucket_list_[__i] = nullptr;
- __node_pointer __pp(static_cast<__node_pointer>(_STD::addressof(__p1_.first())));
+ __node_pointer __pp(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first())));
__node_pointer __cp = __pp->__next_;
if (__cp != nullptr)
{
- size_type __chash = __cp->__hash_ % __nbc;
+ size_type __chash = __constrain_hash(__cp->__hash_, __nbc);
__bucket_list_[__chash] = __pp;
size_type __phash = __chash;
for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr;
__cp = __pp->__next_)
{
- __chash = __cp->__hash_ % __nbc;
+ __chash = __constrain_hash(__cp->__hash_, __nbc);
if (__chash == __phash)
__pp = __cp;
else
size_type __bc = bucket_count();
if (__bc != 0)
{
- size_t __chash = __hash % __bc;
+ size_t __chash = __constrain_hash(__hash, __bc);
__node_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
- __nd->__hash_ % __bc == __chash;
+ __constrain_hash(__nd->__hash_, __bc) == __chash;
__nd = __nd->__next_)
{
if (key_eq()(__nd->__value_, __k))
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return iterator(__nd, this);
+#else
return iterator(__nd);
+#endif
}
}
}
size_type __bc = bucket_count();
if (__bc != 0)
{
- size_t __chash = __hash % __bc;
+ size_t __chash = __constrain_hash(__hash, __bc);
__node_const_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
- __nd->__hash_ % __bc == __chash;
+ __constrain_hash(__nd->__hash_, __bc) == __chash;
__nd = __nd->__next_)
{
if (key_eq()(__nd->__value_, __k))
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return const_iterator(__nd, this);
+#else
return const_iterator(__nd);
+#endif
}
}
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
- __node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
size_t __hash)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
- __node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::move(__v));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
- return _STD::move(__h);
+ return __h;
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
- __node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
- return _STD::move(__h);
+ return _VSTD::move(__h); // explicitly moved for C++03
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
size_t __hash)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
- __node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
- return _STD::move(__h);
+ return _VSTD::move(__h); // explicitly moved for C++03
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p)
{
- __node_pointer __np = const_cast<__node_pointer>(__p.__node_);
+ __node_pointer __np = __p.__node_;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+ "unordered container erase(iterator) called with an iterator not"
+ " referring to this container");
+ _LIBCPP_ASSERT(__p != end(),
+ "unordered container erase(iterator) called with a non-dereferenceable iterator");
+ iterator __r(__np, this);
+#else
iterator __r(__np);
+#endif
++__r;
remove(__p);
return __r;
__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
const_iterator __last)
{
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
+ "unodered container::erase(iterator, iterator) called with an iterator not"
+ " referring to this unodered container");
+ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__last) == this,
+ "unodered container::erase(iterator, iterator) called with an iterator not"
+ " referring to this unodered container");
+#endif
for (const_iterator __p = __first; __first != __last; __p = __first)
{
++__first;
erase(__p);
}
- __node_pointer __np = const_cast<__node_pointer>(__last.__node_);
+ __node_pointer __np = __last.__node_;
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ return iterator (__np, this);
+#else
return iterator (__np);
+#endif
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
{
// current node
- __node_pointer __cn = const_cast<__node_pointer>(__p.__node_);
+ __node_pointer __cn = __p.__node_;
size_type __bc = bucket_count();
- size_t __chash = __cn->__hash_ % __bc;
+ size_t __chash = __constrain_hash(__cn->__hash_, __bc);
// find previous node
__node_pointer __pn = __bucket_list_[__chash];
for (; __pn->__next_ != __cn; __pn = __pn->__next_)
// Fix up __bucket_list_
// if __pn is not in same bucket (before begin is not in same bucket) &&
// if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
- if (__pn == _STD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
+ if (__pn == static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(__p1_.first()))
+ || __constrain_hash(__pn->__hash_, __bc) != __chash)
{
- if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash)
+ if (__cn->__next_ == nullptr || __constrain_hash(__cn->__next_->__hash_, __bc) != __chash)
__bucket_list_[__chash] = nullptr;
}
// if __cn->__next_ is not in same bucket (nullptr is in same bucket)
if (__cn->__next_ != nullptr)
{
- size_t __nhash = __cn->__next_->__hash_ % __bc;
+ size_t __nhash = __constrain_hash(__cn->__next_->__hash_, __bc);
if (__nhash != __chash)
__bucket_list_[__nhash] = __pn;
}
__pn->__next_ = __cn->__next_;
__cn->__next_ = nullptr;
--size();
- return __node_holder(__cn, _D(__node_alloc()));
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __c_node* __c = __get_db()->__find_c_and_lock(this);
+ for (__i_node** __p = __c->end_; __p != __c->beg_; )
+ {
+ --__p;
+ iterator* __i = static_cast<iterator*>((*__p)->__i_);
+ if (__i->__node_ == __cn)
+ {
+ (*__p)->__c_ = nullptr;
+ if (--__c->end_ != __p)
+ memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+ }
+ }
+ __get_db()->unlock();
+#endif
+ return __node_holder(__cn, _Dp(__node_alloc(), true));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
+ _NOEXCEPT_(
+ (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__pointer_allocator>::value) &&
+ (!__node_traits::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__node_allocator>::value) &&
+ __is_nothrow_swappable<hasher>::value &&
+ __is_nothrow_swappable<key_equal>::value)
{
{
__node_pointer_pointer __npp = __bucket_list_.release();
__bucket_list_.reset(__u.__bucket_list_.release());
__u.__bucket_list_.reset(__npp);
}
- _STD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
+ _VSTD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
__swap_alloc(__bucket_list_.get_deleter().__alloc(),
__u.__bucket_list_.get_deleter().__alloc());
__swap_alloc(__node_alloc(), __u.__node_alloc());
- _STD