'Grouping c++ structs according to certain attribute
I have a vector of structs.
struct info
{
propertyX x;
propertyY y;
propertyZ z;
};
std::vector<info> infos;
The objective is to break up this vector into smaller vectors based on a condition. The condition could be to group all infos that have the same propertyX value together or group all infos that have the same propertyY and propertyZ (pair) together.
I am thinking of creating a map with key being some kind of a hash of the properties to be considered and value to be a vector of info.
Is there a better solution that can be used here?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
