1.0.2 API documentation: structured_bindings.hpp Source File

| 1.0.2 API documentation

structured_bindings.hpp
Go to the documentation of this file.
1
9 #pragma once
10
11 // Dependency:
12 #include "../glm.hpp"
13 #include "../gtx/quaternion.hpp"
14
15 #ifdef __cpp_structured_bindings
16 #if __cpp_structured_bindings >= 201606L
17 #include <utility>
18 #include <cstddef>
19 namespace std {
20 template<glm::length_t L,typename T,glm::qualifier Q>
21 struct tuple_size<glm::vec<L, T, Q>> {
22 static constexpr size_t value = L;
23 };
24 template<glm::length_t C,glm::length_t R, typename T, glm::qualifier Q>
25 struct tuple_size<glm::mat<C,R, T, Q>> {
26 static constexpr size_t value = C;
27 };
28 template<typename T, glm::qualifier Q>
29 struct tuple_size<glm::qua<T, Q>> {
30 static constexpr size_t value = 4;
31 };
32 template<std::size_t I,glm::length_t L,typename T,glm::qualifier Q>
33 struct tuple_element<I, glm::vec<L,T,Q>>
34 {
35 GLM_STATIC_ASSERT(I < L,"Index out of bounds");
36 typedef T type;
37 };
38 template<std::size_t I, glm::length_t C, glm::length_t R, typename T, glm::qualifier Q>
39 struct tuple_element<I, glm::mat<C,R, T, Q>>
40 {
41 GLM_STATIC_ASSERT(I < C, "Index out of bounds");
42 typedef glm::vec<R,T,Q> type;
43 };
44 template<std::size_t I, typename T, glm::qualifier Q>
45 struct tuple_element<I, glm::qua<T, Q>>
46 {
47 GLM_STATIC_ASSERT(I < 4, "Index out of bounds");
48 typedef T type;
49 };
50
51 }
52 #endif
53 #endif
54
55 #ifndef GLM_ENABLE_EXPERIMENTAL
56 # error "GLM: GLM_GTX_iteration is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
57 #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
58 # pragma message("GLM: GLM_GTX_io extension included")
59 #endif
60
61 namespace glm
62 {
65
66 template<length_t I, length_t L, typename T, qualifier Q>
67 GLM_FUNC_DECL GLM_CONSTEXPR T& get(vec<L, T, Q>& v);
68 template<length_t I, length_t L, typename T, qualifier Q>
69 GLM_FUNC_DECL GLM_CONSTEXPR T const& get(vec<L, T, Q> const& v);
70
71 template<length_t I, length_t C, length_t R, typename T, qualifier Q>
72 GLM_FUNC_DECL GLM_CONSTEXPR vec<R, T, Q>& get(mat<C, R, T, Q>& m);
73 template<length_t I, length_t C, length_t R, typename T, qualifier Q>
74 GLM_FUNC_DECL GLM_CONSTEXPR vec<R, T, Q> const& get(mat<C, R, T, Q> const& m);
75
76 template<length_t I, typename T, qualifier Q>
77 GLM_FUNC_DECL GLM_CONSTEXPR T& get(qua<T, Q>& q);
78 template<length_t I, typename T, qualifier Q>
79 GLM_FUNC_DECL GLM_CONSTEXPR T const& get(qua<T, Q> const& q);
80
81 #if GLM_HAS_RVALUE_REFERENCES
82 template<length_t I, length_t L,typename T, qualifier Q>
83 GLM_FUNC_DECL GLM_CONSTEXPR T get(vec<L,T, Q> const&& v);
84 template<length_t I,length_t C,length_t R, typename T, qualifier Q>
85 GLM_FUNC_DECL GLM_CONSTEXPR vec<R,T,Q> get(mat<C,R,T, Q> const&& m);
86 template<length_t I, typename T, qualifier Q>
87 GLM_FUNC_DECL GLM_CONSTEXPR T get(qua<T, Q> const&& q);
88 #endif
89 }//namespace glm
91
92 #include "structured_bindings.inl"