Let us consider following code:
#include <concepts>
template<typename X>
struct Concrete_M {
X f() const { return X{}; }
};
struct Concrete_X {};
template<typename T, typename X>
concept M = requires (T t)
{
{ t.f() } -> std::convertible_to<X>;
};
template<M<Concrete_X>>
struct C {};
const C<Concrete_M<Concrete_X>> c{};
Can I use following template template parameter T?
template<template<typename> typename T, typename X>
concept M = requires (T<X> t)
{
{ t.f() } -> std::convertible_to<X>;
};
How should I change
template<M<Concrete_X>>
struct C {};
const C<Concrete_M<Concrete_X>> c{};
to properly use updated concept M? I am looking for something like this:
template<typename X, /* ... */>
struct C {};
const C<Concrete_X, /* ... */> c{};
but I don't understand what should I put instead of /* ... */ comments. I tried:
template<typename X, M<X>>
struct C {};
const C<Concrete_X, Concrete_M<Concrete_X>> c{};
but GCC 10.0.1 raises an error:
(...) ‘M’ does not constrain a type (...)