ORIGINAL
Loading...
Searching...
No Matches
src
core
cloneable.h
1
#ifndef CLONABLE_H
2
#define CLONABLE_H
3
4
namespace
original {
5
template
<
typename
DERIVED>
6
class
baseCloneable {
7
protected
:
8
baseCloneable() =
default
;
9
public
:
10
[[nodiscard]]
virtual
DERIVED* clone()
const
;
11
virtual
~baseCloneable() =
default
;
12
};
13
14
class
cloneable :
public
baseCloneable<cloneable> {
15
protected
:
16
cloneable() =
default
;
17
public
:
18
~cloneable()
override
=
default
;
19
};
20
}
21
22
template
<
typename
DERIVED>
23
auto
original::baseCloneable<DERIVED>::clone() const -> DERIVED* {
24
return
new
DERIVED(
static_cast<
const
DERIVED&
>
(*
this
));
25
}
26
#endif
//CLONABLE_H
Generated by
1.13.2