19 template<
typename SmartPo
inter,
typename T>
21 std::same_as<SmartPointer, std::shared_ptr<T>> ||
22 std::same_as<SmartPointer, std::unique_ptr<T>>;
28 template<
class T,
typename SmartPo
inter = std::shared_ptr<T>>
39 template<
class Target,
typename... Args>
41 if constexpr (std::is_same_v<PointerType, std::shared_ptr<T>>) {
42 return std::make_shared<Target>(std::forward<Args>(args)...);
43 }
else if constexpr (std::is_same_v<PointerType, std::unique_ptr<T>>) {
44 return std::make_unique<Target>(std::forward<Args>(args)...);
46 static_assert(
false,
"Unsupported smart pointer type");
78 virtual constexpr ~
Clonable() noexcept = default;
A class that can be cloned.
Definition clonable.hxx:29
static PointerType MakePointer(Args &&... args)
Definition clonable.hxx:40
constexpr Clonable(const Clonable &)=default
virtual PointerType Clone() const =0
virtual PointerType Move()=0
constexpr Clonable()=default
constexpr Clonable(Clonable &&) noexcept=default
SmartPointer PointerType
Pointer type.
Definition clonable.hxx:31
Concept to check if a type is a valid smart pointer.
Definition clonable.hxx:20
Main namespace for the StormByte library.