C++ Logo

std-discussion

Advanced search

Concept equivalents of type traits.

From: AC Demiralp <demiralpali_at_[hidden]>
Date: Thu, 24 Aug 2023 04:20:13 +0200
Dear all,

this is my first post to this group, and it might not even be the correct
group to post to. Please correct me if I'm wrong.

The following code creates concept equivalents of every type trait that
evaluates to a bool:
https://github.com/acdemiralp/type_trait_concepts/blob/main/include/std/experimental/type_trait_concepts.hpp

This is useful to constrain templates using a simple syntax, without
relying on the more verbose requires keyword. To me, it is the cleanest way
to use concepts. A toy example:
template <integral_c type>
auto function_only_accepting_integral_types() { ... }

Do you think this is useful? Useful enough to be considered into the
standard?

I will build a more complete motivation/proposal with non-toy examples if
you think its worth it.

Good day.

Best regards,
Ali Can Demiralp

Received on 2023-08-24 02:20:26