Questions tagged «std-variant»

3
通过给定条件拆分给定的std :: variant类型
如何通过给定的变体类型 using V = std::variant<bool, char, std::string, int, float, double, std::vector<int>>; 声明两个变体类型 using V1 = std::variant<bool, char, int, float, double>; using V2 = std::variant<std::string, std::vector<int>>; 其中V1包括来自的所有算术类型,V并V2包括来自的所有非算术类型V? V 可以是模板类的参数,例如: template <class V> struct TheAnswer { using V1 = ?; using V2 = ?; }; 通常,条件可以是这样的constexpr变量: template <class T> constexpr bool filter;
20 c++  c++17  std-variant 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.