Код: Выделить всё
template
class Functor {};
template
class Template {};
< /code>
Template- Все функторы должны быть типа Functor
- Все функтор должен быть в последовательности
first Functor must have Start as its first argument - the last Functor must have End as its second argument
- each Functor's first argument is the second Аргумент фанктора предшествует этому
Пример:
Запуск с: char
end: long
Код: Выделить всё
Template t;Код: Выделить всё
1 2 3 4
├─────────┼─────────┼─────────┼─────────┤
argument: char A B C long
Functor #
= 1 Functor,
2 Functor,
3 Functor,
4 Functor
< /code>
code < /h3>
namespace ns
{
template
class Functor
{
public:
using first = X;
using second = Y;
Functor(X lVal) : x(lVal) {}
private:
X x;
};
template
requires(std::is_convertible_v && ...) //error
class Template
{
// How does one use `std::is_convertible_v` on
// an un-specialized template class?
};
template
class Template
{};
}
< /code>
Questions:
[list]
[*]What is the best approach?
[list]
Can this be done with fold expression(s)?
[*]Or concepts?
[/list]
[*]How does one use std::is_convertible[/list]
Подробнее здесь: https://stackoverflow.com/questions/774 ... n-sequence