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