mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Make C++ concepts support mandatory for compilers
The latest GCC and Clang versions both support this, so we can freely use these in our code.
This commit is contained in:
parent
4c0c4f3102
commit
985adcca38
Notes:
sideshowbarker
2024-07-18 11:35:08 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/985adcca38a Pull-request: https://github.com/SerenityOS/serenity/pull/8150 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/alimpfard ✅
2 changed files with 6 additions and 18 deletions
|
@ -11,8 +11,6 @@
|
|||
|
||||
namespace AK::Concepts {
|
||||
|
||||
#if defined(__cpp_concepts) && !defined(__COVERITY__)
|
||||
|
||||
template<typename T>
|
||||
concept Integral = IsIntegral<T>;
|
||||
|
||||
|
@ -31,13 +29,15 @@ concept Unsigned = IsUnsigned<T>;
|
|||
template<typename T, typename U>
|
||||
concept SameAs = IsSame<T, U>;
|
||||
|
||||
// FIXME: remove once Clang formats these properly.
|
||||
// clang-format off
|
||||
template<typename Func, typename... Args>
|
||||
concept VoidFunction = requires(Func func, Args... args)
|
||||
{
|
||||
{
|
||||
func(args...)
|
||||
}
|
||||
->SameAs<void>;
|
||||
-> SameAs<void>;
|
||||
};
|
||||
|
||||
template<typename Func, typename... Args>
|
||||
|
@ -46,15 +46,11 @@ concept IteratorFunction = requires(Func func, Args... args)
|
|||
{
|
||||
func(args...)
|
||||
}
|
||||
->SameAs<IterationDecision>;
|
||||
-> SameAs<IterationDecision>;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
#if defined(__cpp_concepts) && !defined(__COVERITY__)
|
||||
|
||||
using AK::Concepts::Arithmetic;
|
||||
using AK::Concepts::FloatingPoint;
|
||||
using AK::Concepts::Integral;
|
||||
|
@ -62,5 +58,3 @@ using AK::Concepts::IteratorFunction;
|
|||
using AK::Concepts::Signed;
|
||||
using AK::Concepts::Unsigned;
|
||||
using AK::Concepts::VoidFunction;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,16 +12,10 @@
|
|||
|
||||
namespace AK {
|
||||
|
||||
// HACK: This is just here to make syntax highlighting work in Qt Creator.
|
||||
// Once it supports C++20 concepts, we can remove this.
|
||||
#if defined(__cpp_concepts) && !defined(__COVERITY__)
|
||||
template<typename T>
|
||||
concept PointerTypeName = IsPointer<T>;
|
||||
template<PointerTypeName T>
|
||||
#else
|
||||
template<typename T, typename EnableIf<IsPointer<T>, int>::Type = 0>
|
||||
#endif
|
||||
|
||||
template<PointerTypeName T>
|
||||
class Userspace {
|
||||
public:
|
||||
Userspace() = default;
|
||||
|
|
Loading…
Reference in a new issue