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>>
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");
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.
std::conditional_t< is_reference< T >::value, std::expected< std::reference_wrapper< std::remove_reference_t< T > >, std::shared_ptr< E > >, std::expected< T, std::shared_ptr< E > > > Expected
Expected type with support for reference types.
Definition expected.hxx:32