mcqc
mcqc copied to clipboard
Forward declaration of structs and variants
Cyclical recursive references of constructors is a problem. Hopefully, forward declaration in C++ works, so the following for a list is better
template<class T>
struct Coq_nil;
template<class T>
struct Coq_cons;
template<class T>
using list = std::variant<Coq_nil<T>, Coq_cons<T>>;
template<class T>
struct Coq_nil {};
template<class T>
struct Coq_cons {
T a;
std::shared_ptr<list<T>> b;
Coq_cons(T a, std::shared_ptr<list<T>> b) {
this->a = a;
this->b = b;
};
};