#pragma once #include namespace ext { /** Allows to make std::shared_ptr from T with protected constructor. * * Derive your T class from shared_ptr_helper and add shared_ptr_helper as a friend * and you will have static 'create' method in your class. */ template struct shared_ptr_helper { template static std::shared_ptr create(TArgs &&... args) { return std::shared_ptr(new T(std::forward(args)...)); } }; template struct is_shared_ptr { static constexpr bool value = false; }; template struct is_shared_ptr> { static constexpr bool value = true; }; template inline constexpr bool is_shared_ptr_v = is_shared_ptr::value; }