object: use more descriptive CRTP parameters
This commit is contained in:
parent
6e1ffd4d0e
commit
272e46ff8a
24
object.hpp
24
object.hpp
@ -27,9 +27,9 @@
|
||||
namespace cruft::vk {
|
||||
/// the base class for all non-trivial vulkan objects requiring lifetime
|
||||
/// management.
|
||||
template <typename T>
|
||||
template <typename SelfT>
|
||||
struct object {
|
||||
object (native_t<T> _native):
|
||||
object (native_t<SelfT> _native):
|
||||
m_native (_native)
|
||||
{
|
||||
CHECK_NEQ (m_native, VK_NULL_HANDLE);
|
||||
@ -45,7 +45,7 @@ namespace cruft::vk {
|
||||
auto& native (void)& { return m_native; }
|
||||
|
||||
protected:
|
||||
native_t<T> m_native;
|
||||
native_t<SelfT> m_native;
|
||||
};
|
||||
|
||||
|
||||
@ -71,13 +71,13 @@ namespace cruft::vk {
|
||||
/// a vulkan object that must be directly instantiated through
|
||||
/// constructor arguments, rather than being enumerated and owned by
|
||||
/// another object.
|
||||
template <typename T>
|
||||
struct descendant : public object<T> {
|
||||
template <typename SelfT>
|
||||
struct descendant : public object<SelfT> {
|
||||
template <typename ParentT, typename ...Args>
|
||||
descendant (ParentT &parent, Args &&...args):
|
||||
object<T> (
|
||||
object<SelfT> (
|
||||
cruft::vk::error::try_query(
|
||||
life_traits<native_t<T>>::create,
|
||||
life_traits<native_t<SelfT>>::create,
|
||||
parent.native (),
|
||||
std::forward<Args> (args)...
|
||||
)
|
||||
@ -87,17 +87,17 @@ namespace cruft::vk {
|
||||
|
||||
~descendant ()
|
||||
{
|
||||
life_traits<native_t<T>>::destroy (this->native (), nullptr);
|
||||
life_traits<native_t<SelfT>>::destroy (this->native (), nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// a vulkan object that is obtained by listings from a parent object.
|
||||
template <typename T>
|
||||
struct enumerated : public object<T> {
|
||||
using object<T>::object;
|
||||
template <typename SelfT>
|
||||
struct enumerated : public object<SelfT> {
|
||||
using object<SelfT>::object;
|
||||
|
||||
static std::vector<T>
|
||||
static std::vector<SelfT>
|
||||
find (const instance &parent);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user