S
Single Stage to Orbit
Hello!
Suppose I have the following:
int main()
{
typedef boost::tuple<int, int, int> tuple3;
std::vector<tuple3> tuples;
tuples.push_back(tuple3(1, 2, 3));
tuples.push_back(tuple3(7, 8, 9));
tuples.push_back(tuple3(4, 5, 6));
for (auto& i : tuples)
std::cout << i.get<0>() << " " << i.get<1>() << " " <<
i.get<2>() << '\n';
return 0;
}
Is it even possible to have something like this:
for (auto& i : tuples)
{
for (unsigned j = 0; j < 3; ++j)
{
std::cout << i.get<j>();
if (j < 3)
std::cout << " ";
}
std::cout << '\n';
}
When I try it, GCC 4.6.3 says it's illegal to have an non constant
expression as in 'i.get<j>'. Are there any workarounds for this one?
Thanks!
Suppose I have the following:
int main()
{
typedef boost::tuple<int, int, int> tuple3;
std::vector<tuple3> tuples;
tuples.push_back(tuple3(1, 2, 3));
tuples.push_back(tuple3(7, 8, 9));
tuples.push_back(tuple3(4, 5, 6));
for (auto& i : tuples)
std::cout << i.get<0>() << " " << i.get<1>() << " " <<
i.get<2>() << '\n';
return 0;
}
Is it even possible to have something like this:
for (auto& i : tuples)
{
for (unsigned j = 0; j < 3; ++j)
{
std::cout << i.get<j>();
if (j < 3)
std::cout << " ";
}
std::cout << '\n';
}
When I try it, GCC 4.6.3 says it's illegal to have an non constant
expression as in 'i.get<j>'. Are there any workarounds for this one?
Thanks!