0.9.7: range.hpp Source File

| 0.9.7

- Main Page
- Modules
- Files

- File List

range.hpp
Go to the documentation of this file.
1
41 #pragma once
42
43 // Dependencies
44 #include "../detail/setup.hpp"
45
46 #if !GLM_HAS_RANGE_FOR
47 # error "GLM_GTX_range requires C++11 suppport or 'range for'"
48 #endif
49
50 #include "../gtc/type_ptr.hpp"
51
52 namespace glm{
53 namespace detail
54 {
55 /* The glm types provide a .length() member, but for matrices
56 this only defines the number of columns, so we need to work around this */
57 template <typename T, precision P>
58 detail::component_count_t number_of_elements_(tvec2<T, P> const & v){
59 return detail::component_count(v);
60 }
61
62 template <typename T, precision P>
63 detail::component_count_t number_of_elements_(tvec3<T, P> const & v){
64 return detail::component_count(v);
65 }
66
67 template <typename T, precision P>
68 detail::component_count_t number_of_elements_(tvec4<T, P> const & v){
69 return detail::component_count(v);
70 }
71
72 template <typename genType>
73 detail::component_count_t number_of_elements_(genType const & m){
74 return detail::component_count(m) * detail::component_count(m[0]);
75 }
76 }//namespace
77
80
81 template <typename genType>
82 const typename genType::value_type * begin(genType const & v){
83 return value_ptr(v);
84 }
85
86 template <typename genType>
87 const typename genType::value_type * end(genType const & v){
88 return begin(v) + detail::number_of_elements_(v);
89 }
90
91 template <typename genType>
92 typename genType::value_type * begin(genType& v){
93 return value_ptr(v);
94 }
95
96 template <typename genType>
97 typename genType::value_type * end(genType& v){
98 return begin(v) + detail::number_of_elements_(v);
99 }
100
102 }//namespace glm
glm
Definition: _noise.hpp:40
glm::value_ptr
GLM_FUNC_DECL genType::value_type const * value_ptr(genType const &vec)
Return the constant address to the data of the input parameter.