Logical Combination of Concepts
Concepts can be combined with the logical operators && and ||
#include <concepts>
#include <iostream>
template <typename T>
concept TinyType = requires(T t) {
sizeof(T) <= 4;
requires sizeof(T) <= 4;
};
template <typename T>
T func(T t)
requires std::integral<T> && TinyType<T>
{
std::cout << "Value: " << t << std::endl;
}
template <typename T>
T func2(T t)
requires std::integral<T> || std::floating_point<T>
{
std::cout << "Value of number: " << t << std::endl;
}