I don't think there's any data type suitable for this in either the standard library or in Boost.
pair<T, T>
is definitely wrong:
make_pair(1, 2) == make_pair(2, 1)
should be true if these represent the roots of a polynomial!
For the same reason, an array/vector won't work either, unless you change the comparison behavior.
So I'd say make a bag<T, N>
data type that represents a multiset<T>
with a fixed size, kind of like how array<T, N>
represents a vector<T>
with a fixed size.
Since the size is small, you can just do everything by brute force (comparison, equality checking, etc.).