template <typename T, size_t N, typename Allocator>
class small_vector {
union {
static_vector<T, N> inline;
std::vector<T, Allocator> heap;
} storage;
};

.... 🤔

Upside: easiest implementation of my life.

Downside: I have to store the discriminant outside the storage, so I can't know which is which without taking extra space for that.

@thephd Doom: knowing that the discriminator could have fit without adding that extra word of storage will drive you to implement something 100x more complicated and .1% more efficient.
@dgregor79 @thephd I’m increasingly of the opinion that these sorts of small-container optimizations are basically never worth it.
@steve @thephd I think small-string, where you can fit a bunch of ASCII characters in the space of a pointer, is about the only place it makes sense. That, and a free “empty container” representation. Otherwise, nobody picks N well enough and you just wasted code size and stack space.
@dgregor79 @thephd exactly. The single-element collection is the one other that might sometimes make sense, but, eh…
@dgregor79 @steve @thephd Collections that dynamically end up with one element are important. *Specialized* single-element collections are negligible