Vector Tuple Help!

Does anyone know how Vector Tuples work ?

Array of Vec2’s

WayPoints[0][0] = cocos2d::Vec2(-2460 / TIscale, 1000 / TIscale);//ZERO IS MOST TIGHT CORNER
WayPoints[0][1] = cocos2d::Vec2(-2540 / TIscale, 1000 / TIscale);//ONE IS MIDDLE
WayPoints[0][2] = cocos2d::Vec2(-2620 / TIscale, 1000 / TIscale);//TWO IS LEAST TIGHT CORNER

WayPoints[1][0] = cocos2d::Vec2(-2330 / TIscale, 1150 / TIscale);
WayPoints[1][1] = cocos2d::Vec2(-2370 / TIscale, 1200 / TIscale);//WAY POINT 2
WayPoints[1][2] = cocos2d::Vec2(-2420 / TIscale, 1250 / TIscale);

WayPoints[2][0] = cocos2d::Vec2(-1150 / TIscale, 1150 / TIscale);
WayPoints[2][1] = cocos2d::Vec2(-1100 / TIscale, 1200 / TIscale);//WAY POINT 3
WayPoints[2][2] = cocos2d::Vec2(-1050 / TIscale, 1250 / TIscale);


int i = 0;
for (i = 0; i < 62; i++) {
	std::vector<cocos2d::Vec2> id1(i, WayPoints[i][0]);
	std::vector<cocos2d::Vec2> id2(i, WayPoints[i][1]);
	std::vector<cocos2d::Vec2> id3(i, WayPoints[i][2]);
	wayPointVectorsTuple.push_back(std::make_tuple(id1, id2, id3));
}

for(auto iter = wayPointVectorsTuple.begin(); iter != wayPointVectorsTuple.end(); iter++){

	auto mytuple = *iter;

	unsigned int i = 0;
	for (i = 0; i < 3; ++i) {
		cocos2d::Vec2 one = std::get<0>(mytuple)[i];
		cocos2d::Vec2 two = std::get<1>(mytuple)[i];
		cocos2d::Vec2 three = std::get<2>(mytuple)[i];

	}
}

Of course doesn’t work

Issue starts here - > cocos2d::Vec2 one = std::get<0>(mytuple)[i];

Is this correct at all in anyways ?

This isn’t correct I can see that.

Does this not access my Vec2 from the vector ?

Your implementation is really hard to follow. I get why because you have 3 sets of waypoints you are working with.

Making an std::vector that contains an coos2d:Vector is one example

Yes each way point has three points… I want to add them all into a tuple vector and then access them afterwards somehow

I followed these helpers from stackoverflow at no gain



:frowning:

This is what is in my header

	std::vector<std::tuple< std::vector<cocos2d::Vec2>, std::vector<cocos2d::Vec2>, std::vector<cocos2d::Vec2>>> wayPointVectorsTuple;