#C++ is weird.

1 messages · Page 1 of 1 (latest)

cobalt grove
#

Why is the following legal:

struct List{
    std::variant<int, std::vector<List>> data;
};

but this isn't legal?

using Integer = int;
using List = std::variant<Integer, std::vector<List>>;
radiant sedgeBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

hollow glade
cobalt grove
#

Kinda of like the same way I can't do something like:

struct A {
  A foo;
};
#

?

#

I mean one is using a undeclared identifier and the other is using a incomplete type, but I think they are similar scenarios

fickle wraith
#

Maybe if using Integer; was made legal it would work.

radiant sedgeBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.