Returning Vector in C++

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AlbertCG93

I’m having trouble trying to return a Vector of a custom class.

class A : public Object {
    GDCLASS(A, Object);

public:
    Vector<A> get_vector() {
        return vector;
    }

protected:
    Vector<A> vector;
};

I’ve tried storing it as a Reference:

 class A : public Object {
    GDCLASS(A, Object);

public:
    Ref<Vector<A>> get_vector() {
        return vector;
    }

protected:
    Ref<Vector<A>> vector;
};

But it still doesn’t work and I’ve no idea what to do, and the official documentation isn’t helping much.

Is this GDNative or a C++ module?

Calinou | 2020-12-17 00:45