15template <
typename T>
class Owner {
16 std::unique_ptr<T>
Own;
28 auto Ptr = std::make_unique<U>(std::forward<ArgTys>(
args)...);
34 template <
typename U =
T,
35 typename = std::enable_if_t<std::is_base_of_v<T, U>>>
43 const T *
get()
const {
return Own.get(); }
48 return static_cast<bool>(
Own);
61 std::vector<std::unique_ptr<T>>
Owns;
74 auto Own = std::make_unique<U>(std::forward<ArgTys>(
args)...);
75 auto *
Ref = Own.get();
76 Owns.push_back(std::move(Own));
81 template <
typename U =
T,
82 typename = std::enable_if_t<std::is_base_of_v<T, U>>>
83 U *
add(std::unique_ptr<U> Own) {
84 auto *
Ref = Own.get();
85 Owns.push_back(std::move(Own));
93 T &
at(std::size_t Index) {
return *
Refs.at(Index); }
94 const T &
at(std::size_t Index)
const {
return *
Refs.at(Index); }
auto begin() const noexcept
Definition Owner.h:130
std::vector< std::unique_ptr< T > > Owns
Definition Owner.h:61
OwnerArray & operator=(const OwnerArray &)=delete
auto begin() noexcept
Definition Owner.h:127
const T & back() const
Definition Owner.h:100
T & at(std::size_t Index)
Definition Owner.h:93
const T & operator[](std::size_t Index) const
Definition Owner.h:91
T & front()
Definition Owner.h:96
auto end() noexcept
Definition Owner.h:128
auto cbegin() const noexcept
Definition Owner.h:133
const std::vector< T * > & get() const noexcept
Definition Owner.h:123
const T & front() const
Definition Owner.h:97
void clear() noexcept
Definition Owner.h:117
void reserve(std::size_t Size)
Definition Owner.h:112
auto cend() const noexcept
Definition Owner.h:134
OwnerArray(OwnerArray &&) noexcept=default
std::size_t size() const noexcept
Definition Owner.h:103
OwnerArray(const OwnerArray &)=delete
T & back()
Definition Owner.h:99
U * add(std::unique_ptr< U > Own)
Definition Owner.h:83
auto end() const noexcept
Definition Owner.h:131
bool empty() const noexcept
Definition Owner.h:108
std::vector< T * > Refs
Definition Owner.h:62
const T & at(std::size_t Index) const
Definition Owner.h:94
T & operator[](std::size_t Index)
Definition Owner.h:90
U * add(ArgTys &&...args)
Definition Owner.h:73
Owner(Owner &&) noexcept=default
T * get()
Definition Owner.h:42
std::unique_ptr< T > Own
Definition Owner.h:16
Owner(const Owner &)=delete
U * set(ArgTys &&...args)
Definition Owner.h:27
U * set(std::unique_ptr< U > Ptr)
Definition Owner.h:36
void reset() noexcept
Definition Owner.h:44
Owner & operator=(const Owner &)=delete
const T * get() const
Definition Owner.h:43
资源的强类型引用,同时覆盖持久化 ID 与运行时索引两种边界。
Definition ResourceRef.h:36
世界矩阵 描述坐标系,左手坐标系 使用 DirectX12 坐标系的描述
Definition Application.h:15