I am using a vector which has struct type of elements in it. The struct is something like this:
1 2 3 4 5 6
|
struct block
{
std::string id1;
std::string id2;
std::string last_line;
};
|
The example value of id1 of first vector element is: id1 = 0001VVYF
The example value of id2 of first vector element is: id2 = 0001VW1S
AND
The example value of id1 of second vector element is: id1 = 0001VW1S
The example value of id2 of second vector element is: id2 = 0001VVYF
i-e
1) the value of id1 of first vector element is equal to the value of id2 of second vector element
2) the value of id2 of first vector element is equal to the value of id1 of second vector element.
In the program I have to find out whether the IDs of one vector element match the IDs of another vector element. I am not concerned about the id1 and id2. I am concerned about the values they hold in any order. It would be easier to compare if similar values appear against the same id e-g
The example value of id1 of first vector element is: id1 = 0001VVYF
The example value of id2 of first vector element is: id2 = 0001VW1S
AND
The example value of id1 of second vector element is: id2 = 0001VVYF
The example value of id2 of second vector element is: id1 = 0001VW1S
Is it possible to sort the vector this way i-e similar values appear against similar IDs?