template <typename T, size_t N, typename Allocator>
class small_vector {
union {
static_vector<T, N> inline;
std::vector<T, Allocator> heap;
} storage;
};
.... 🤔
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.