I have a simple Vec3<T> class, and I would like to update it using C++20 concepts (Clang 10.0.0 with -std=c++20). The new version looks something like this:
template <typename T> concept Arithmetic = std::is_arithmetic_v<T>;
template <typename T> concept FloatingPoint = std::is_floating_point_v<T>;
template <Arithmetic T> struct Vec3 {
T x, y, z;
/* operator overloading, etc.. */
void normalize() requires FloatingPoint<T>;
};
Is that a proper use of C++20 concepts? The core guideline T11 recommends using standard concepts as much as possible, but I couldn't find the ones I wanted in the list of C++ named requirements, nor in the <concepts> header file. Is this because my concepts are too specific, and shouldn't be concepts at all in the first place?
My original code uses a mix of static_assert and SFINAE to get to the end result.