length becomes a static function #565

This commit is contained in:
Christophe Riccio 2016-11-01 08:26:18 +01:00
parent e98ce44d85
commit 9298939816
4 changed files with 18 additions and 9 deletions

View File

@ -79,7 +79,7 @@ namespace glm
/// Return the count of components of the vector /// Return the count of components of the vector
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; GLM_FUNC_DECL static length_type length(){return 4;}
GLM_FUNC_DECL T & operator[](length_type i); GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const; GLM_FUNC_DECL T const & operator[](length_type i) const;

View File

@ -324,12 +324,6 @@ namespace detail
// -- Component accesses -- // -- Component accesses --
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::length_type tvec4<T, P>::length() const
{
return 4;
}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i) GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i)
{ {

View File

@ -154,7 +154,7 @@ namespace detail
return (compute_rand<uint32, P, vecType>::call() % (Max + static_cast<uint32>(1) - Min)) + Min; return (compute_rand<uint32, P, vecType>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
} }
}; };
template <precision P, template <class, precision> class vecType> template <precision P, template <class, precision> class vecType>
struct compute_linearRand<int64, P, vecType> struct compute_linearRand<int64, P, vecType>
{ {

View File

@ -1,7 +1,22 @@
struct vec4
{
static int length();
};
int vec4::length()
{
return 4;
}
int main() int main()
{ {
int Failed = 0; int Failed = 0;
vec4 V;
int LengthA = V.length();
int LengthB = vec4::length();
return Failed; return Failed;
} }