且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将std :: string的std :: vector转换为任意类型的std :: tuple

更新时间:2022-11-19 21:25:55

代码中有两个问题。
第一:你应该 #include< sstream>

There are two problems in your code. First: you should #include <sstream>.

code> std :: get< std :: tuple_size< ...>>(tuple),这是不正确的,因为没有这样的索引。您可以使用此

Second: there is call of std::get<std::tuple_size<...>>(tuple), that is incorrect, since there is no such index. You can fix it by using this

void Execute(std::vector<std::string> call)
{
    //auto size = call.size();
    Parse(std::integral_constant<std::size_t,
    std::tuple_size<decltype(args)>::value - 1>{}, args, call);
   //CallFunc(GenerateArgumentIndexPack<std::tuple_size<decltype(args)>::value>::Pack());
}

关于您的第二个错误 CallFunc ,此函数应为

About your second error in CallFunc, this function should be

CallFunc(typename
GenerateArgumentIndexPack<std::tuple_size<decltype(args)>::value>::Pack());

如编译器错误所述。