From 68d04eb43f620f884d6c9f12e1b796e908d57621 Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Mon, 30 Jan 2023 16:05:53 +0100 Subject: [PATCH] Added IsPointerToType --- src/concepts.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/concepts.hpp b/src/concepts.hpp index 4bbcc2a..d38e006 100644 --- a/src/concepts.hpp +++ b/src/concepts.hpp @@ -1,8 +1,12 @@ #pragma once #include +#include #include +#include +#include + namespace gz::util { /// Satisfied when T is in PackTypes template @@ -23,6 +27,19 @@ namespace gz::util { template concept ContiguousRange = std::ranges::contiguous_range and std::same_as, ValueType>; + /// ObjectType accessible via *t and convertible to bool + template + concept IsPointerToType = requires (T t/*, std::ptrdiff_t idx*/) { + /* { t.operator*() } -> std::same_as>; */ + /* { t.operator->() } -> std::same_as>; */ + /* { t.operator[](idx) } -> std::same_as>; */ + { *t } -> std::same_as>; + /* { t-> } -> std::same_as>; */ + { static_cast(t) }; + }; + static_assert(IsPointerToType, int>, ""); + static_assert(IsPointerToType, ""); + }