Hello, there is such code (UnicodeString is a string from c ++ builder):
struct CTestParams { int TestDelay; double TglTest; double DtTglTest; int NumberVsi; int View; int NumberChannel; std::string Name; }; class CTest { public: template<typename...Arg> CTest(Arg&&...args) { std::tuple<Arg...> tl { std::forward<Arg>(args)... }; std::tie(testFolder, mimsFolder, resultFolder, nameTest, params) = tl; } CTest() : CTest_base(), mimsFolder(), nameTest(), resultFolder(), params() {} private: UnicodeString testFolder; UnicodeString mimsFolder; UnicodeString nameTest; UnicodeString resultFolder; CTestParams params; }; class CP { public: void set_data(const CTest& elem) { data = elem; } void set_dummy_test() { set_data(CTest {"...","...","...","...", CTestParams{} }); } private: CTest data; }; int main() { CP cp; cp.set_dummy_test(); }
a bunch of errors crashes in the string with std :: tie ... what could be wrong here? errors:
ctest.h (35): in instantiation of function template specialization 'std :: tuple :: operator =' requested here
[bcc64 Error] tuple (365): no viable overloaded '='
tuple (495): function const _Mybase ’(for aka con const tuple <>’) to con const _ Myt ’(aka con const tuple ') for the 1st argument;
compiler c ++ builder x64
UnicodeString
when callingCTest
, i.e.CTest { UnicodeString("..."), ...
, etc. But in general, is a template constructor really needed here? - αλεχολυτ