Template Class Cloneable

Inheritance Relationships

Base Type

  • public BaseType

Class Documentation

template<typename BaseType, typename DerivedType>
class aslam::Cloneable : public BaseType

Implements the cloneable concept using the CRTP and constructor inheritance.


class Vehicle {
  Vehicle() = delete;
  Vehicle(int speed) : speed_(speed) {};
  virtual Vehicle* clone() const = 0;  // Make sure to add the pure virtual function clone
  const int speed_;

class Car : public aslam::Cloneable<Vehicle, Car> {
  Car(int speed) : Base(speed) {};     // Use the "Base" typedef defined by the Cloneable class

Public Types

typedef Cloneable Base

Public Functions

inline virtual BaseType *clone() const

Method to clone this instance.

inline virtual ~Cloneable()