ORIGINAL
Loading...
Searching...
No Matches
cloneable.h
Go to the documentation of this file.
1#ifndef CLONEABLE_H
2#define CLONEABLE_H
3#include "config.h"
4
5
12namespace original {
21template<typename DERIVED>
23protected:
28 baseCloneable() = default;
29
30public:
44 [[nodiscard]] virtual DERIVED* clone() const;
45
50 virtual ~baseCloneable() = default;
51};
52
59class cloneable : public baseCloneable<cloneable> {
60protected:
65 cloneable() = default;
66
67public:
72 ~cloneable() override = default;
73};
74
75} // namespace original
76
77// ----------------- Definitions of cloneable.h -----------------
78
79template<typename DERIVED>
81 return new DERIVED(static_cast<const DERIVED&>(*this));
82}
83
84#endif //CLONEABLE_H
Base class that defines a cloneable interface.
Definition cloneable.h:22
virtual ~baseCloneable()=default
Virtual destructor for baseCloneable.
baseCloneable()=default
Default constructor for baseCloneable.
virtual DERIVED * clone() const
Creates a clone of the current object.
Definition cloneable.h:80
Concrete cloneable class with custom cloning behavior.
Definition cloneable.h:59
~cloneable() override=default
Virtual destructor for cloneable.
cloneable()=default
Default constructor for cloneable.
Platform-independent type definitions and compiler/platform detection.
Main namespace for the project Original.
Definition algorithms.h:21