Reputation: 37441
I'm trying to have a function return std::tuple<Qstring, int>
, but I'm getting this compiler error:
std::tuple<QString, int> foo()
{
auto fst = getFst();
auto snd = getSnd();
return std::make_tuple(fst, snd);
}
`error: no viable conversion from 'tuple<[...], typename __make_tuple_return::type>' to 'tuple<[...], int>'``
What am I doing wrong?
Upvotes: 0
Views: 1185
Reputation: 118350
There's nothing wrong with this code. It compiles without any issues.
$ cat t.C
#include <QString>
#include <tuple>
std::tuple<QString, int> foo()
{
QString fst = QString("fst");
int snd = 2;
return std::make_tuple(fst, snd);
}
$ g++ -std=c++11 -I/usr/include/QtCore -c -o t.o t.C
$ g++ --version
g++ (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Upvotes: 1