The reduced amount of code reduces maintenance. Providing prevector::operator<=> allows classes that are implemented in terms of prevector to use the compiler provided operator<=>.
However, there is a breaking change!
The old implementation claims to be a drop-in replacement for std::vector. However, the implementation for operator< is different when comparing two vectors of different length, as can be presented with the following code:
0int main()
1{
2 auto const v12 = std::vector{1, 2};
3 auto const v3 = std::vector{3};
4
5 auto const pv12 = prevector<4, int>(v12.begin(), v12.end());
6 auto const pv3 = prevector<4, int>(v3.begin(), v3.end());
7
8 assert((v12 < v3) == (pv12 < pv3));
9}
With the old implementation of prevector, the assertion fails. With my change, it passes.
I ask the reviewers to confirm whether this change in behavior is acceptable or not.