class mrpt::rtti::CObject
Overview
Virtual base to provide a compiler-independent RTTI system.
Each class named Foo will have associated smart pointer types:
Foo::Ptr=>std::shared_ptr<Foo>(the most commonly-used one)Foo::ConstPtr=>std::shared_ptr<const Foo>Foo::UniquePtr=>std::unique_ptr<Foo>Foo::ConstUniquePtr=>std::unique_ptr<const Foo>
It is recommended to use MRPT-defined std::make_shared<> instead of std::make_shared<> to create objects, to avoid memory alignment problems caused by classes containing Eigen vectors or matrices. Example:
Foo::Ptr o = std::make_shared<Foo>();
Or using the shorter auxiliary static method ::Create() for conciseness or to keep compatibility with MRPT 1.5.* code bases:
Foo::Ptr o = Foo::Create();
If a special memory allocator is needed, use Foo::CreateAlloc(alloc,...);.
See also:
#include <mrpt/rtti/CObject.h> class CObject { }; // direct descendants class CMultiObjectiveMotionOptimizerBase; class CSerializable;