Giuseppe Remondo
2014-11-11 16:11:24 UTC
Hello c.l.c++,
I'm quite new to C++. I'm a bit lost in understanding why
the definition of 'vt1' does not compile. Can you please
tell me which constructor is being called and why it's not
doing what I'd like it should?
#include <string>
#include <tuple>
#include <vector>
using std::string;
using std::tuple;
using std::make_tuple;
using std::vector;
int main()
{
tuple<string, int> t{"hello", 0}; //ok
vector<tuple<string, int>> vt1{{"hello", 0}}; //error
vector<tuple<string, int>> vt2{make_tuple("hello", 0)}; //ok
}
I'm quite new to C++. I'm a bit lost in understanding why
the definition of 'vt1' does not compile. Can you please
tell me which constructor is being called and why it's not
doing what I'd like it should?
#include <string>
#include <tuple>
#include <vector>
using std::string;
using std::tuple;
using std::make_tuple;
using std::vector;
int main()
{
tuple<string, int> t{"hello", 0}; //ok
vector<tuple<string, int>> vt1{{"hello", 0}}; //error
vector<tuple<string, int>> vt2{make_tuple("hello", 0)}; //ok
}
--
Gius
Gius