1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <concepts>
#include <iostream>
template <typename T>
concept Test = std::destructible<T>;
template <Test T>
class MyTest {
public:
T value;
};
// From template<typename T, typename ... U>
template<typename T, typename ... U>
concept IsAnyOf = (std::same_as<T, U> || ...);
template<typename T>
concept IsPrintable =
std::integral<T> || std::floating_point<T> ||
IsAnyOf < std::remove_cvref_t<std::remove_pointer_t<std::decay_t<T>>>,
char, wchar_t > ;
void println(IsPrintable auto const... arguments) {
(std::wcout << ... << arguments) << '\n';
}
int main() {
MyTest<int> test;
println("Example: ", 3.14, " : ", 42, " : [", 'a', L'-', L"Z]");
return 0;
}
|