我正在尝试使用clang 5.0
使用C ++模块,并且试图了解如何从一个模块中导出从另一个模块中导入的内容。那有可能吗?
例如,我想要这样的东西:
// root.hehe.cppm
export module root.hehe;
class hehe
{
};
和此:
// root.cppm
export module root;
import root.hehe;
export class hehe; // ... doesn't work!
export hehe; // Also doesn't work!
export import root.hehe; // No dice!
以便最终我可以做类似的事情
import root;
// ...
hehe myhehe;
这有可能吗?我还尝试弄清楚是否可以导入root
的所有子模块,例如import root.*
,但这也不起作用。
在C ++ 20中(不是Clang中的任何原型版本,您可以使用以下任何一种方法>]
export using ::hehe; export using hehe=hehe;
为此,有两个警告:
root.hehe
没有导出它。 (对于类型别名方法,能够通过decltype
左右命名就足够了。)您还可以使用export import root.hehe;
重新导出被导入模块导出的everything