XRTraits C++ OpenXR Utilities
Public Types | Public Member Functions | List of all members
xrtraits::Initialized< T > Struct Template Reference

#include <InitXrType.h>

Inheritance diagram for xrtraits::Initialized< T >:
Inheritance graph
[legend]
Collaboration diagram for xrtraits::Initialized< T >:
Collaboration graph
[legend]

Public Types

using xr_type = T
 The OpenXR structure type. More...
 
using const_xr_type = std::add_const_t< T >
 The OpenXR structure type (const). More...
 

Public Member Functions

constexpr xr_typeget () noexcept
 Get pointer to OpenXR type. More...
 
constexpr const_xr_typeget () const noexcept
 Get pointer to OpenXR type (const overload). More...
 
void type () const =delete
 
void next () const =delete
 
constexpr Initialized () noexcept
 Default constructor - initializes OpenXR struct's type member. More...
 
template<typename U , typename... Args>
constexpr Initialized (Initialized< U > const &nextStruct, Args... a) noexcept
 
template<typename U , typename... Args>
constexpr Initialized (Initialized< U > &nextStruct, Args... a) noexcept
 
template<typename A1 , typename... Args, typename = std::enable_if_t<!detail::is_chainable_struct_v<A1>>>
constexpr Initialized (A1 &&a1, Args... a) noexcept
 
constexpr Initialized (Initialized &&) noexcept=default
 
constexpr Initialized (Initialized const &)=delete
 
constexpr Initializedoperator= (Initialized const &)=delete
 
constexpr Initializedoperator= (Initialized &&)=delete
 

Detailed Description

template<typename T>
struct xrtraits::Initialized< T >

Wrapper for stack-allocated OpenXR tagged structs that auto-initializes the type member correctly.

Inherits from the type parameter, so this object is the same size as the OpenXR struct and exposes the same members, etc...

Template Parameters
Tan OpenXR tagged type with known type tag.
Examples:
twocall-in-place-sized-and-initialized.cpp, and twocall-size-hint-and-initialized.cpp.

Member Typedef Documentation

◆ const_xr_type

template<typename T>
using xrtraits::Initialized< T >::const_xr_type = std::add_const_t<T>

The OpenXR structure type (const).

◆ xr_type

template<typename T>
using xrtraits::Initialized< T >::xr_type = T

The OpenXR structure type.

Constructor & Destructor Documentation

◆ Initialized() [1/5]

template<typename T>
constexpr xrtraits::Initialized< T >::Initialized ( )
inlinenoexcept

Default constructor - initializes OpenXR struct's type member.

◆ Initialized() [2/5]

template<typename T>
template<typename U , typename... Args>
constexpr xrtraits::Initialized< T >::Initialized ( Initialized< U > const &  nextStruct,
Args...  a 
)
inlineexplicitnoexcept

Constructor to reference a chained struct (passed as Initialized<U>).

Initializes OpenXR struct's type member, and the next member to the given structure's address. Any additional parameters are forwarded as member initializers to the underlying struct.

References xrtraits::is_same_v.

◆ Initialized() [3/5]

template<typename T>
template<typename U , typename... Args>
constexpr xrtraits::Initialized< T >::Initialized ( Initialized< U > &  nextStruct,
Args...  a 
)
inlineexplicitnoexcept

Constructor to reference a possibly non-const chained struct (passed as Initialized<U>).

Initializes OpenXR struct's type member, and the next member to the given structure's address. Any additional parameters are forwarded as member initializers to the underlying struct.

References xrtraits::is_same_v.

◆ Initialized() [4/5]

template<typename T>
template<typename A1 , typename... Args, typename = std::enable_if_t<!detail::is_chainable_struct_v<A1>>>
constexpr xrtraits::Initialized< T >::Initialized ( A1 &&  a1,
Args...  a 
)
inlineexplicitnoexcept

Constructor that forwards initializers and has no chained struct.

Initializes OpenXR struct's type member, and forwards the rest of the arguments on as initializers.

◆ Initialized() [5/5]

template<typename T>
constexpr xrtraits::Initialized< T >::Initialized ( Initialized< T > &&  )
defaultnoexcept

Default move-constructor - mainly for assignment-style initialization.

Member Function Documentation

◆ get() [1/2]

template<typename T>
constexpr xr_type* xrtraits::Initialized< T >::get ( )
inlinenoexcept

Get pointer to OpenXR type.

◆ get() [2/2]

template<typename T>
constexpr const_xr_type* xrtraits::Initialized< T >::get ( ) const
inlinenoexcept

Get pointer to OpenXR type (const overload).

◆ next()

template<typename T>
void xrtraits::Initialized< T >::next ( ) const
delete

Can't access the underlying struct's next member by design.

Naming this here and explicitly deleting it makes it harder to accidentally mess up an OpenXR struct's next member (unless you really try hard). If you get an error on this line, it's because you're trying to manually look at or modify type, which shouldn't be done.

◆ type()

template<typename T>
void xrtraits::Initialized< T >::type ( ) const
delete

Can't access the underlying struct's type member by design.

Naming this here and explicitly deleting it makes it harder to accidentally mess up an OpenXR struct's type member (unless you really try hard). If you get an error on this line, it's because you're trying to manually look at or modify type, which shouldn't be done.


The documentation for this struct was generated from the following file: