这种元组递归引用安全吗?

Is this recursive reference with tuples safe?

我正在试验并写了这个怪物:

class my_tuple : public std::tuple < std::vector<my_tuple> > {};

它似乎可以编译并实际工作。我发现它很狡猾,因为以下内容无法编译:

using my_other_tuple = std::tuple < std::vector<my_other_tuple> > ;

最终,我想弄明白为什么 my_tuple 有效,以及是否有任何潜在的可怕后果。我正在尝试了解元组的全部内容以及我 can/am 应该如何处理它们。因此,如果有人愿意对此发表评论,提供一些精辟的见解,我将不胜感激。

Windows 7 和 VS 2013。

class my_tuple : public std::tuple < std::vector<my_tuple> > {};

这是当前未定义的行为,因为它实例化了一个标准库容器,std::vector,类型不完整,my_tuple,直到其结束 }定义。但是,有一个proposal to permit instantiating certain standard containers, including std::vector, with incomplete types. Boost.Containers supports incomplete types as well.

using my_other_tuple = std::tuple < std::vector<my_other_tuple> > ;

这是错误的格式。 [dcl.typedef]/p2,强调我的:

A typedef-name can also be introduced by an alias-declaration. The identifier following the using keyword becomes a typedef-name and the optional attribute-specifier-seq following the identifier appertains to that typedef-name. It has the same semantics as if it were introduced by the typedef specifier. In particular, it does not define a new type and it shall not appear in the type-id.