我有以下两个结构体:
template<typename T>
struct one { /* ... */ };
template<template<typename...> typename T>
struct two { /* ... */ };
当我有以下实例化/未实例化模板时:
template<typename T>
struct sample_templated { /* ... */ };
using instantiated = sample_templated<double>;
那么我可以做什么?
one<instantiated>{};
two<sample_templated>{};
没问题。我希望将one
和two
的定义合并,这样它们就有了相同的名称,这将允许递归。
我尝试着使用默认的定义,例如:
template<typename...>
struct types_match_impl;
如何解决这个问题?
可以将两个原始结构体作为该结构体的部分特化,但这与“two”不兼容。
types_match_impl
传递给它自己。您能展示一下您想编写的代码,并描述一下您认为它应该做什么吗? - jxh