1
I implemented the traveling salesman and show the minimum cost of all paths. Now I want to show the path that corresponds to the lowest cost.
I’m using to do this one pair<int, vector<int> > x
, where as first I place the minimum cost and on the Second I place my path vector.
When I put x.make_pair(custoMinimo, push_back(caminho))
, he makes the mistake:
struct std::pair<int, std::vector<int> >’ has no member named ‘make_pair’
Does anyone have any idea how to fix this?
It worked here Lucas, thanks ! Let me just ask you something else, how would I sweep this pair of vector ? As the size is not part of pair, as we would do ?
– user15930
And a usual pair, then
x.first
and a whole andx.second
and a vector. So Voce can do something likefor (auto &it : x.second) cout << it << endl;
or something like that to print the integers in the vector.– Lucas Virgili
@user15930 if the reply meets you can mark as "Accept" by clicking on the check mark next to the reply (in V form). More information here: How and why to accept an answer?
– Math
worked out, thanks Lucas !
– user15930
so a detail, @user15930, I used a few things from the 'recent' pattern of c++, grandchild may not work on old compilers.
– Lucas Virgili