Monado OpenXR Runtime
Loading...
Searching...
No Matches
g_traits.hpp File Reference

Shared type traits for glue classes. More...

#include <type_traits>
Include dependency graph for g_traits.hpp:

Go to the source code of this file.

Variables

template<class Base , class Derived , class = void>
constexpr bool xrt::util::is_non_virtual_base_v = false
 True when Base is an accessible, non-virtual base of Derived, that is a Base * can be static_cast down to Derived *.
 

Detailed Description

Shared type traits for glue classes.

Variable Documentation

◆ is_non_virtual_base_v

template<class Base , class Derived , class = void>
constexpr bool xrt::util::is_non_virtual_base_v = false
inlineconstexpr

True when Base is an accessible, non-virtual base of Derived, that is a Base * can be static_cast down to Derived *.

That cast is ill-formed for a virtual base, so this is false for virtual inheritance. The glue wrappers use it to reject virtual inheritance of the glue base, which would break pointer recovery.

Todo:
C++17 has no direct trait for "is virtual base"; revisit with a cleaner formulation if reflection (C++26) makes one available.