【发布时间】:2021-07-03 16:51:45
【问题描述】:
对于概念,C++20 提供了很好的语法,例如
template<typename T>
concept SomeConcept = true; // stuff here
template<typename T>
requires SomeConcept<T>
class Foo;
template<SomeConcept T>
class Foo;
这两种概念限制类的方式是等价的,但后者更简洁。
如果我现在有一些模板模板概念,例如
template<template<typename> typename T>
concept SomeOtherConcept = true; // stuff here
template<template<typename> typename T>
requires SomeOtherConcept<T>
class Foo;
我不知道没有要求条款的非冗长(简洁/简短)语法,例如
template<template<typename> SomeotherConcept T>
class Foo;
template<template<SomeOtherConcept> typename T>
class Foo;
没用,所以
声明这样一个模板模板类的正确语法是什么?对模板模板参数有概念限制?
【问题讨论】:
标签: c++ templates c++20 c++-concepts