[libc++] Fix template parameter naming and enforce it through readability-identifier-naming

Reviewed By: #libc, Mordante

Spies: Mordante, aheejin, libcxx-commits

Differential Revision: https://reviews.llvm.org/D156059
This commit is contained in:
Nikolas Klauser 2023-07-24 19:53:39 -07:00
parent 3326feb397
commit 1e24b4d3fd
20 changed files with 146 additions and 137 deletions

View File

@ -50,6 +50,14 @@ CheckOptions:
value: lower_case
- key: readability-identifier-naming.LocalVariablePrefix
value: __
- key: readability-identifier-naming.TemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.TemplateParameterPrefix
value: _
- key: readability-identifier-naming.TemplateParameterIgnoredRegexp
value: (.*\:auto|expr-type) # This is https://llvm.org/PR56464
- key: readability-identifier-naming.ValueTemplateParameterIgnoredRegexp # TODO: enforce naming of variable parameters
value: .*
# TODO: investigate these checks
# bugprone-branch-clone,

View File

@ -731,12 +731,12 @@ move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCons
// swap_ranges
template <class __C1, class __C2>
_LIBCPP_HIDE_FROM_ABI __bit_iterator<__C2, false>
__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
__bit_iterator<__C2, false> __result)
template <class _Cl, class _Cr>
_LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cr, false>
__swap_ranges_aligned(__bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last,
__bit_iterator<_Cr, false> __result)
{
typedef __bit_iterator<__C1, false> _I1;
typedef __bit_iterator<_Cl, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
const int __bits_per_word = _I1::__bits_per_word;
@ -781,12 +781,12 @@ __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1,
return __result;
}
template <class __C1, class __C2>
_LIBCPP_HIDE_FROM_ABI __bit_iterator<__C2, false>
__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
__bit_iterator<__C2, false> __result)
template <class _Cl, class _Cr>
_LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cr, false>
__swap_ranges_unaligned(__bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last,
__bit_iterator<_Cr, false> __result)
{
typedef __bit_iterator<__C1, false> _I1;
typedef __bit_iterator<_Cl, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
const int __bits_per_word = _I1::__bits_per_word;
@ -881,11 +881,11 @@ __swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1
return __result;
}
template <class __C1, class __C2>
template <class _Cl, class _Cr>
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<_Cr, false>
swap_ranges(__bit_iterator<_Cl, false> __first1, __bit_iterator<_Cl, false> __last1,
__bit_iterator<_Cr, false> __first2)
{
if (__first1.__ctz_ == __first2.__ctz_)
return _VSTD::__swap_ranges_aligned(__first1, __last1, __first2);
@ -1314,15 +1314,15 @@ private:
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 _Cl, class _Cr>friend __bit_iterator<_Cr, false> __swap_ranges_aligned(__bit_iterator<_Cl, false>,
__bit_iterator<_Cl, false>,
__bit_iterator<_Cr, false>);
template <class _Cl, class _Cr>friend __bit_iterator<_Cr, false> __swap_ranges_unaligned(__bit_iterator<_Cl, false>,
__bit_iterator<_Cl, false>,
__bit_iterator<_Cr, false>);
template <class _Cl, class _Cr>friend __bit_iterator<_Cr, false> swap_ranges(__bit_iterator<_Cl, false>,
__bit_iterator<_Cl, false>,
__bit_iterator<_Cr, false>);
template <class _Dp>
_LIBCPP_CONSTEXPR_SINCE_CXX20
friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>,

View File

@ -26,8 +26,8 @@ namespace chrono
{
struct local_t {};
template<class Duration>
using local_time = time_point<local_t, Duration>;
template<class _Duration>
using local_time = time_point<local_t, _Duration>;
using local_seconds = local_time<seconds>;
using local_days = local_time<days>;

View File

@ -120,9 +120,9 @@ private:
// TODO FMT Validate whether lazy creation is the best solution.
optional<_VSTD::locale> __loc_;
template <class __OutIt, class __CharT>
friend _LIBCPP_HIDE_FROM_ABI basic_format_context<__OutIt, __CharT>
__format_context_create(__OutIt, basic_format_args<basic_format_context<__OutIt, __CharT>>,
template <class _OtherOutIt, class _OtherCharT>
friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT>
__format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>,
optional<_VSTD::locale>&&);
// Note: the Standard doesn't specify the required constructors.
@ -133,9 +133,9 @@ private:
: __out_it_(_VSTD::move(__out_it)), __args_(__args),
__loc_(_VSTD::move(__loc)) {}
#else
template <class __OutIt, class __CharT>
friend _LIBCPP_HIDE_FROM_ABI basic_format_context<__OutIt, __CharT>
__format_context_create(__OutIt, basic_format_args<basic_format_context<__OutIt, __CharT>>);
template <class _OtherOutIt, class _OtherCharT>
friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT>
__format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>);
_LIBCPP_HIDE_FROM_ABI
explicit basic_format_context(_OutIt __out_it,

View File

@ -111,8 +111,9 @@ public:
return __underlying_.parse(__ctx);
}
template <class FormatContext>
_LIBCPP_HIDE_FROM_ABI typename FormatContext::iterator format(__maybe_const_r& __range, FormatContext& __ctx) const {
template <class _FormatContext>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
format(__maybe_const_r& __range, _FormatContext& __ctx) const {
return __underlying_.format(__range, __ctx);
}
};

View File

@ -21,30 +21,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
template <class __Operation>
template <class _Operation>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st
: public __unary_function<typename __Operation::second_argument_type, typename __Operation::result_type>
: public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type>
{
protected:
__Operation op;
typename __Operation::first_argument_type value;
_Operation op;
typename _Operation::first_argument_type value;
public:
_LIBCPP_INLINE_VISIBILITY binder1st(const __Operation& __x,
const typename __Operation::first_argument_type __y)
_LIBCPP_INLINE_VISIBILITY binder1st(const _Operation& __x,
const typename _Operation::first_argument_type __y)
: op(__x), value(__y) {}
_LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
(typename __Operation::second_argument_type& __x) const
_LIBCPP_INLINE_VISIBILITY typename _Operation::result_type operator()
(typename _Operation::second_argument_type& __x) const
{return op(value, __x);}
_LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
(const typename __Operation::second_argument_type& __x) const
_LIBCPP_INLINE_VISIBILITY typename _Operation::result_type operator()
(const typename _Operation::second_argument_type& __x) const
{return op(value, __x);}
};
template <class __Operation, class _Tp>
template <class _Operation, class _Tp>
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
binder1st<__Operation>
bind1st(const __Operation& __op, const _Tp& __x)
{return binder1st<__Operation>(__op, __x);}
binder1st<_Operation>
bind1st(const _Operation& __op, const _Tp& __x)
{return binder1st<_Operation>(__op, __x);}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)

View File

@ -21,30 +21,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
template <class __Operation>
template <class _Operation>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd
: public __unary_function<typename __Operation::first_argument_type, typename __Operation::result_type>
: public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type>
{
protected:
__Operation op;
typename __Operation::second_argument_type value;
_Operation op;
typename _Operation::second_argument_type value;
public:
_LIBCPP_INLINE_VISIBILITY
binder2nd(const __Operation& __x, const typename __Operation::second_argument_type __y)
binder2nd(const _Operation& __x, const typename _Operation::second_argument_type __y)
: op(__x), value(__y) {}
_LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
( typename __Operation::first_argument_type& __x) const
_LIBCPP_INLINE_VISIBILITY typename _Operation::result_type operator()
( typename _Operation::first_argument_type& __x) const
{return op(__x, value);}
_LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
(const typename __Operation::first_argument_type& __x) const
_LIBCPP_INLINE_VISIBILITY typename _Operation::result_type operator()
(const typename _Operation::first_argument_type& __x) const
{return op(__x, value);}
};
template <class __Operation, class _Tp>
template <class _Operation, class _Tp>
_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
binder2nd<__Operation>
bind2nd(const __Operation& __op, const _Tp& __x)
{return binder2nd<__Operation>(__op, __x);}
binder2nd<_Operation>
bind2nd(const _Operation& __op, const _Tp& __x)
{return binder2nd<_Operation>(__op, __x);}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)

View File

@ -32,13 +32,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Layout policy with a mapping which corresponds to FORTRAN-style array layouts
struct layout_left {
template <class Extents>
template <class _Extents>
class mapping;
};
// Layout policy with a mapping which corresponds to C-style array layouts
struct layout_right {
template <class Extents>
template <class _Extents>
class mapping;
};

View File

@ -89,8 +89,8 @@ private:
}
};
template <class Callback>
_LIBCPP_AVAILABILITY_SYNC stop_callback(stop_token, Callback) -> stop_callback<Callback>;
template <class _Callback>
_LIBCPP_AVAILABILITY_SYNC stop_callback(stop_token, _Callback) -> stop_callback<_Callback>;
#endif // _LIBCPP_STD_VER >= 20

View File

@ -284,8 +284,8 @@ public:
return get();
}
template <class _Tp_ = _Tp, class _Up = enable_if_t<is_convertible<
const _Tp_, const element_type *>::value>>
template <class _Dummy = _Tp, class _Up = enable_if_t<is_convertible<
const _Dummy, const element_type *>::value>>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator const element_type *() const {
return get();
}
@ -300,8 +300,8 @@ public:
return get();
}
template <class _Tp_ = _Tp, class _Up = enable_if_t<
is_convertible<_Tp_, element_type *>::value>>
template <class _Dummy = _Tp, class _Up = enable_if_t<
is_convertible<_Dummy, element_type *>::value>>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator element_type *() {
return get();
}

View File

@ -132,20 +132,20 @@ template <template<class...> class _Op, class... _Args>
template <template<class...> class _Op, class... _Args>
_LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value;
template <class Default, template<class...> class _Op, class... _Args>
using detected_or = _DETECTOR<Default, void, _Op, _Args...>;
template <class Default, template<class...> class _Op, class... _Args>
using detected_or_t = typename detected_or<Default, _Op, _Args...>::type;
template <class _Default, template<class...> class _Op, class... _Args>
using detected_or = _DETECTOR<_Default, void, _Op, _Args...>;
template <class _Default, template<class...> class _Op, class... _Args>
using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
template <class Expected, template<class...> class _Op, class... _Args>
using is_detected_exact = is_same<Expected, detected_t<_Op, _Args...>>;
template <class Expected, template<class...> class _Op, class... _Args>
_LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<Expected, _Op, _Args...>::value;
template <class _Expected, template<class...> class _Op, class... _Args>
using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
template <class _Expected, template<class...> class _Op, class... _Args>
_LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value;
template <class To, template<class...> class _Op, class... _Args>
using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, To>;
template <class To, template<class...> class _Op, class... _Args>
_LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<To, _Op, _Args...>::value;
template <class _To, template<class...> class _Op, class... _Args>
using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, _To>;
template <class _To, template<class...> class _Op, class... _Args>
_LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value;
_LIBCPP_END_NAMESPACE_LFTS

View File

@ -3593,15 +3593,15 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>;
#endif
template<class _Codecvt, class _Elem = wchar_t,
class _Wide_alloc = allocator<_Elem>,
class _Byte_alloc = allocator<char> >
class _WideAlloc = allocator<_Elem>,
class _ByteAlloc = allocator<char> >
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert
{
public:
typedef basic_string<char, char_traits<char>, _Byte_alloc> byte_string;
typedef basic_string<_Elem, char_traits<_Elem>, _Wide_alloc> wide_string;
typedef typename _Codecvt::state_type state_type;
typedef typename wide_string::traits_type::int_type int_type;
typedef basic_string<char, char_traits<char>, _ByteAlloc> byte_string;
typedef basic_string<_Elem, char_traits<_Elem>, _WideAlloc> wide_string;
typedef typename _Codecvt::state_type state_type;
typedef typename wide_string::traits_type::int_type int_type;
private:
byte_string __byte_err_string_;
@ -3663,25 +3663,25 @@ public:
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
wstring_convert(_Codecvt* __pcvt)
: __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
{
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
wstring_convert(_Codecvt* __pcvt, state_type __state)
: __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
{
}
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err)
: __byte_err_string_(__byte_err), __wide_err_string_(__wide_err),
__cvtstate_(), __cvtcount_(0)
@ -3691,9 +3691,9 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
#ifndef _LIBCPP_CXX03_LANG
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
wstring_convert(wstring_convert&& __wc)
: __byte_err_string_(_VSTD::move(__wc.__byte_err_string_)),
__wide_err_string_(_VSTD::move(__wc.__wide_err_string_)),
@ -3706,15 +3706,15 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert()
template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::~wstring_convert()
{
delete __cvtptr_;
}
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::wide_string
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
typename wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wide_string
wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
from_bytes(const char* __frm, const char* __frm_end)
{
_LIBCPP_SUPPRESS_DEPRECATED_POP
@ -3774,9 +3774,9 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
return __wide_err_string_;
}
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::byte_string
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
typename wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::byte_string
wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
to_bytes(const _Elem* __frm, const _Elem* __frm_end)
{
__cvtcount_ = 0;

View File

@ -683,7 +683,7 @@ class optional;
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
concept __is_derived_from_optional = requires(const _Tp& __t) { []<class __Up>(const optional<__Up>&) {}(__t); };
concept __is_derived_from_optional = requires(const _Tp& __t) { []<class _Up>(const optional<_Up>&) {}(__t); };
# endif // _LIBCPP_STD_VER >= 20

View File

@ -453,17 +453,17 @@ public:
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
template <class _T1, class _C1>
template <class _T1, class _OtherContainer>
friend
_LIBCPP_INLINE_VISIBILITY
bool
operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
operator==(const queue<_T1, _OtherContainer>& __x,const queue<_T1, _OtherContainer>& __y);
template <class _T1, class _C1>
template <class _T1, class _OtherContainer>
friend
_LIBCPP_INLINE_VISIBILITY
bool
operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
operator< (const queue<_T1, _OtherContainer>& __x,const queue<_T1, _OtherContainer>& __y);
};
#if _LIBCPP_STD_VER >= 17

View File

@ -116,11 +116,11 @@ public:
};
__cxx_atomic_wait(&__a_.__a_, __test_fn);
}
template <class Rep, class Period>
template <class _Rep, class _Period>
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
bool try_acquire_for(chrono::duration<Rep, Period> const& __rel_time)
bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time)
{
if (__rel_time == chrono::duration<Rep, Period>::zero())
if (__rel_time == chrono::duration<_Rep, _Period>::zero())
return try_acquire();
auto const __test_fn = [this]() { return try_acquire(); };
return std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time);
@ -178,9 +178,9 @@ public:
{
__semaphore_.acquire();
}
template<class Rep, class Period>
template<class _Rep, class _Period>
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
bool try_acquire_for(chrono::duration<Rep, Period> const& __rel_time)
bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time)
{
return __semaphore_.try_acquire_for(chrono::duration_cast<chrono::nanoseconds>(__rel_time));
}
@ -189,11 +189,11 @@ public:
{
return __semaphore_.try_acquire();
}
template <class Clock, class Duration>
template <class _Clock, class _Duration>
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
bool try_acquire_until(chrono::time_point<Clock, Duration> const& __abs_time)
bool try_acquire_until(chrono::time_point<_Clock, _Duration> const& __abs_time)
{
auto const __current = Clock::now();
auto const __current = _Clock::now();
if (__current >= __abs_time)
return try_acquire();
else

View File

@ -370,10 +370,10 @@ public:
_LIBCPP_HIDE_FROM_ABI void lock();
_LIBCPP_HIDE_FROM_ABI bool try_lock();
template <class Rep, class Period>
_LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<Rep, Period>& __rel_time);
template <class Clock, class Duration>
_LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<Clock, Duration>& __abs_time);
template <class _Rep, class _Period>
_LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time);
template <class _Clock, class _Duration>
_LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
_LIBCPP_HIDE_FROM_ABI void unlock();
// Setters

View File

@ -304,15 +304,15 @@ public:
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
template <class T1, class _C1>
template <class _T1, class _OtherContainer>
friend
bool
operator==(const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
operator==(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
template <class T1, class _C1>
template <class _T1, class _OtherContainer>
friend
bool
operator< (const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
operator< (const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
};
#if _LIBCPP_STD_VER >= 17

View File

@ -960,13 +960,13 @@ public:
// tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants)
template <template <class...> class Pred, class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
template <template <class...> class _Pred, class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
struct _CtorPredicateFromPair : false_type{};
template <template <class...> class Pred, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
struct _CtorPredicateFromPair<Pred, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > : _And<
Pred<_Tp1, __copy_cvref_t<_Pair, _Up1> >,
Pred<_Tp2, __copy_cvref_t<_Pair, _Up2> >
template <template <class...> class _Pred, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
struct _CtorPredicateFromPair<_Pred, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > : _And<
_Pred<_Tp1, __copy_cvref_t<_Pair, _Up1> >,
_Pred<_Tp2, __copy_cvref_t<_Pair, _Up2> >
> {};
template <class _Pair>
@ -1207,15 +1207,15 @@ public:
}
#endif // _LIBCPP_STD_VER >= 23
template <template<class...> class Pred, bool _Const,
template <template<class...> class _Pred, bool _Const,
class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
struct _AssignPredicateFromPair : false_type {};
template <template<class...> class Pred, bool _Const,
template <template<class...> class _Pred, bool _Const,
class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
struct _AssignPredicateFromPair<Pred, _Const, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > :
_And<Pred<__maybe_const<_Const, _Tp1>&, __copy_cvref_t<_Pair, _Up1> >,
Pred<__maybe_const<_Const, _Tp2>&, __copy_cvref_t<_Pair, _Up2> >
struct _AssignPredicateFromPair<_Pred, _Const, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > :
_And<_Pred<__maybe_const<_Const, _Tp1>&, __copy_cvref_t<_Pair, _Up1> >,
_Pred<__maybe_const<_Const, _Tp2>&, __copy_cvref_t<_Pair, _Up2> >
> {};
template <bool _Const, class _Pair>

View File

@ -1274,7 +1274,7 @@ struct __all_overloads : _Bases... {
using _Bases::operator()...;
};
template <class IdxSeq>
template <class _IdxSeq>
struct __make_overloads_imp;
template <size_t ..._Idx>

View File

@ -3419,12 +3419,12 @@ inline constexpr bool __format::__enable_insertable<vector<wchar_t>> = true;
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 23
template <class _Tp, class CharT>
template <class _Tp, class _CharT>
// Since is-vector-bool-reference is only used once it's inlined here.
requires same_as<typename _Tp::__container, vector<bool, typename _Tp::__container::allocator_type>>
struct _LIBCPP_TEMPLATE_VIS formatter<_Tp, CharT> {
struct _LIBCPP_TEMPLATE_VIS formatter<_Tp, _CharT> {
private:
formatter<bool, CharT> __underlying_;
formatter<bool, _CharT> __underlying_;
public:
template <class _ParseContext>