I'm learning C++20 concepts. Is there a way to do a conjunction of concepts in-place before an auto? For example, If I have a MutableGraph<G> concept and a VertexListGraph<G> concept, I could define
template <typename G>
concept MutableVertexListGraph = MutableGraph<G> && VertexListGraph<G>;
and do
MutableVertexListGraph auto g = ...;
but it's annoying to name the concept when it's just that I want it to model both concepts. It would be nice if I could do
MutableGraph && VertexListGraph auto g = ...; // && not allowed here.
or even something like
template <typename T, concept... Concepts> // <- "concept" not allowed here.
concept ModelsAll = (Concepts<T> && ...);
...
ModelsAll<MutableGraph, VertexListGraph> auto g = ...;
I can of course do
MutableGraph auto g = ...;
requires { MutableGraph<decltype(g)>; };
which lacks symmetry, or
auto g = ...;
requires { MutableGraph<decltype(g)>; MutableGraph<decltype(g)>; };
which lacks the concept on the declaration line.