mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-09 08:47:48 +00:00
Compare commits
2 Commits
7c6b6f980c
...
cc55c10911
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cc55c10911 | ||
![]() |
d766c527c7 |
@ -5,9 +5,19 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <version>
|
||||||
|
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
#if defined(__cpp_lib_ranges_contains) && __cpp_lib_ranges_contains >= 202202L
|
||||||
|
|
||||||
|
// Use the standard library functions if available (C++23)
|
||||||
|
inline constexpr auto& Contains = std::ranges::contains;
|
||||||
|
inline constexpr auto& ContainsSubrange = std::ranges::contains_subrange;
|
||||||
|
|
||||||
|
#else
|
||||||
|
// TODO C++23: This old implementation likely isn't needed once migrated to C++23. Remove them or
|
||||||
|
// this file itself. Ad hoc implementations for C++20
|
||||||
struct ContainsFn
|
struct ContainsFn
|
||||||
{
|
{
|
||||||
template <std::input_iterator I, std::sentinel_for<I> S, class T, class Proj = std::identity>
|
template <std::input_iterator I, std::sentinel_for<I> S, class T, class Proj = std::identity>
|
||||||
@ -54,8 +64,8 @@ struct ContainsSubrangeFn
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO C++23: Replace with std::ranges::contains.
|
|
||||||
inline constexpr ContainsFn Contains{};
|
inline constexpr ContainsFn Contains{};
|
||||||
// TODO C++23: Replace with std::ranges::contains_subrange.
|
|
||||||
inline constexpr ContainsSubrangeFn ContainsSubrange{};
|
inline constexpr ContainsSubrangeFn ContainsSubrange{};
|
||||||
|
|
||||||
|
#endif
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
Loading…
Reference in New Issue
Block a user