How do i use `ptr()` with a `Vector<>` list of a custom class in 4.0?

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

I am porting my hierarchical pathfinding and navigation layers functionality in Astar3D from Godot 3,

I have a an error that I cannot seem to resolve in astar.cpp:

-I have a custom Octant class to define “point chunks” though I cannot seem to use ptr() with Vector<Octant*> (the type of prev_octants below ) to achieve :

const Octant* r = o->prev_octants.ptr();

which returns this error when compiling:


core\math\a_star.cpp(875): error C2440: 'initializing': cannot convert from 'const T *' to 'const AStar3D::Octant *'
        with
        [
            T=AStar3D::Octant *
        ]
core\math\a_star.cpp(875): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast

In 3.5.2 prev_octants was a PoolVector<Octant*> in which PoolVector<Octant*>::Read r = o->prev_octants.read(); was used,
how do I achieve the same thing?

And I my one other question is:

  • In the same context as the last question, what happened to r.release() is it no longer used or has it been renamed to something else?