Vector with Incomplete type (C++)
#include <vector>
struct S {
std::vector<S> v;
};
int main() { S s; }struct V : std::vector<S> {}; would work as well.
see also
- boost
- My favourite memory leak - beware of swapping self referring vector above V v.swap( v.front());
Written on July 10, 2018, Last update on August 14, 2025
c++
tree
vector