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

Written on July 10, 2018, Last update on June 19, 2024
c++ tree vector