XRTraits C++ OpenXR Utilities
Common.h
Go to the documentation of this file.
1 // Copyright 2018-2019, Collabora, Ltd.
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4  * @file
5  * @brief Header with common utilities used by multiple headers
6  * @author Ryan Pavlik <ryan.pavlik@collabora.com>
7  */
8 
9 #pragma once
10 
11 // Internal Includes
12 // - none
13 
14 // Library Includes
15 // - none
16 
17 // Standard Includes
18 #include <type_traits>
19 
20 namespace xrtraits {
21 
22 //! Variable template wrapping std::is_pointer<T>::value
23 template <typename T> constexpr bool is_pointer_v = std::is_pointer<T>::value;
24 
25 //! Variable template wrapping std::is_reference<T>::value
26 template <typename T>
27 constexpr bool is_reference_v = std::is_reference<T>::value;
28 
29 //! Variable template wrapping std::is_const<T>::value
30 template <typename T> constexpr bool is_const_v = std::is_const<T>::value;
31 
32 //! Variable template wrapping std::is_same<T, U>::value
33 template <typename T, typename U>
34 constexpr bool is_same_v = std::is_same<T, U>::value;
35 
36 } // namespace xrtraits
37 
38 
39 
40 #if (__cplusplus >= 201703L) && !defined(XRTRAITS_HAVE_CXX17)
41 #define XRTRAITS_HAVE_CXX17
42 #endif
43 
44 #if defined(XRTRAITS_HAVE_CXX17) && !defined(XRTRAITS_HAVE_OPTIONAL)
45 #define XRTRAITS_HAVE_OPTIONAL
46 #endif
47 
48 #if defined(XRTRAITS_HAVE_CXX17) && !defined(XRTRAITS_HAVE_CONSTEXPR_IF)
49 #define XRTRAITS_HAVE_CONSTEXPR_IF
50 #endif
Main namespace for these C++ OpenXR utilities.
Definition: GetChained.h:26
constexpr bool is_const_v
Variable template wrapping std::is_const<T>::value.
Definition: Common.h:30
constexpr bool is_same_v
Variable template wrapping std::is_same<T, U>::value.
Definition: Common.h:34
constexpr bool is_pointer_v
Variable template wrapping std::is_pointer<T>::value.
Definition: Common.h:23
constexpr bool is_reference_v
Variable template wrapping std::is_reference<T>::value.
Definition: Common.h:27