I have this code:
template<typename ...T>
struct Test
{
void call(string str)
{
abc(get<T>(str)...);
}
template<typename U>
string get(string& inp)
{
string ret{ inp[0] };
inp.erase(0, 1);
cout << ret << endl; // first "a", next "b", next "c" - everything is ok
return ret;
}
void abc(string a, string b, string c)
{
cout << a << " " << b << " " << c << endl; // "b c a" - why?
}
};
I'm calling it like this:
Test<int, bool, float> test;
test.call("abc");
And the output is b c a
thought I expect a b c
. Moreover in get()
function I have a correct order. Why is this? I can't find any rule about this order.