Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid concepts when __cpp_lib_concepts isn't defined #1749

Merged
merged 3 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions stl/inc/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,19 @@ namespace chrono {
};

#if _HAS_CXX20
template <class _Clock, class = void>
inline constexpr bool _Is_clock_v = false;
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved

template <class _Clock>
concept _Is_clock = requires {
typename _Clock::rep;
typename _Clock::period;
typename _Clock::duration;
typename _Clock::time_point;
_Clock::is_steady;
_Clock::now();
};
inline constexpr bool
_Is_clock_v<_Clock, void_t<typename _Clock::rep, typename _Clock::period, typename _Clock::duration,
typename _Clock::time_point, decltype(_Clock::is_steady), decltype(_Clock::now())>> =
true; // TRANSITION, GH-602

template <class _Clock>
struct is_clock : bool_constant<_Is_clock<_Clock>> {};
struct is_clock : bool_constant<_Is_clock_v<_Clock>> {};
template <class _Clock>
inline constexpr bool is_clock_v = _Is_clock<_Clock>;
inline constexpr bool is_clock_v = _Is_clock_v<_Clock>;
#endif // _HAS_CXX20

// CLASS TEMPLATE duration
Expand Down
8 changes: 4 additions & 4 deletions stl/inc/sstream
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public:
}

#if _HAS_CXX20
template <_Allocator _Alloc2>
template <class _Alloc2, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0>
_NODISCARD basic_string<_Elem, _Traits, _Alloc2> str(const _Alloc2& _Al) const {
return basic_string<_Elem, _Traits, _Alloc2>{view(), _Al};
}
Expand Down Expand Up @@ -632,7 +632,7 @@ public:
}

#if _HAS_CXX20
template <_Allocator _Alloc2>
template <class _Alloc2, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0>
_NODISCARD basic_string<_Elem, _Traits, _Alloc2> str(const _Alloc2& _Al) const {
return _Stringbuffer.str(_Al);
}
Expand Down Expand Up @@ -752,7 +752,7 @@ public:
}

#if _HAS_CXX20
template <_Allocator _Alloc2>
template <class _Alloc2, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0>
_NODISCARD basic_string<_Elem, _Traits, _Alloc2> str(const _Alloc2& _Al) const {
return _Stringbuffer.str(_Al);
}
Expand Down Expand Up @@ -878,7 +878,7 @@ public:
}

#if _HAS_CXX20
template <_Allocator _Alloc2>
template <class _Alloc2, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0>
_NODISCARD basic_string<_Elem, _Traits, _Alloc2> str(const _Alloc2& _Al) const {
return _Stringbuffer.str(_Al);
}
Expand Down
5 changes: 0 additions & 5 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -1459,11 +1459,6 @@ using _Enable_if_execution_policy_t = typename remove_reference_t<_ExPo>::_Stand

#endif // _HAS_CXX17

#if _HAS_CXX20
template <class _Ty>
concept _Allocator = _Is_allocator<_Ty>::value;
#endif // _HAS_CXX20

// FUNCTION TEMPLATE _Idl_distance
template <class _Checked, class _Iter>
_NODISCARD constexpr auto _Idl_distance(const _Iter& _First, const _Iter& _Last) {
Expand Down