It depends on many thing, my solution is mixing std::tuple
and std::map
typedef std::tuple<Polygon , Polygon , int, int> Params;
std::map<Params, Polygon> results;
Which maps parameters to results. In this case you can find result of an specific input efficiently.
To use, you have to overload operator<
for Polygon
because of std::map
:
struct Polygon
{
// ...
};
inline bool operator<(const Polygon &p1, const Polygon &p2)
{
return ...;
}
Polygon p1, p2, p3;
// ...
results.insert(std::make_pair(std::make_tuple(p1, p2, 1, 2), p3));