boost :: tuple中模板化参数的数量

Abr*_*ile 3 c++ tuples boost-tuples

我正在使用boost::tuple我的代码.

假设我想存储一个具有3个成员的结构的等价物

  typedef boost::tuple< std::string, int, double > my_struct;
Run Code Online (Sandbox Code Playgroud)

是否有任何方法可以调用,tuple这将给我包含的成员数量,在这种情况下3?

我的目标是监控何时增加模板参数的数量.

dal*_*lle 10

使用::boost::tuples::length<T>::value辅助函数.

文档.