Skip to content

Commit

Permalink
length() member functions are constexpr #657
Browse files Browse the repository at this point in the history
  • Loading branch information
Groovounet committed Jul 24, 2017
1 parent 50a527c commit 1b78e2b
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 72 deletions.
16 changes: 8 additions & 8 deletions glm/detail/type_mat2x2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ namespace glm
col_type value[2];

public:
// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Constructors --

GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR;
Expand Down Expand Up @@ -66,14 +74,6 @@ namespace glm
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<3, 4, T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x);

// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 2;}

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Unary arithmetic operators --

GLM_FUNC_DECL mat<2, 2, T, P> & operator=(mat<2, 2, T, P> const & v) GLM_DEFAULT;
Expand Down
16 changes: 8 additions & 8 deletions glm/detail/type_mat2x3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ namespace glm
col_type value[2];

public:
// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Constructors --

GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR;
Expand Down Expand Up @@ -67,14 +75,6 @@ namespace glm
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x);

// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 2;}

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Unary arithmetic operators --

GLM_FUNC_DECL mat<2, 3, T, P> & operator=(mat<2, 3, T, P> const & m) GLM_DEFAULT;
Expand Down
16 changes: 8 additions & 8 deletions glm/detail/type_mat2x4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ namespace glm
col_type value[2];

public:
// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Constructors --

GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR;
Expand Down Expand Up @@ -69,14 +77,6 @@ namespace glm
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x);

// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 2;}

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Unary arithmetic operators --

GLM_FUNC_DECL mat<2, 4, T, P> & operator=(mat<2, 4, T, P> const & m) GLM_DEFAULT;
Expand Down
16 changes: 8 additions & 8 deletions glm/detail/type_mat3x2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ namespace glm
col_type value[3];

public:
// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Constructors --

GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR;
Expand Down Expand Up @@ -74,14 +82,6 @@ namespace glm
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x);

// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 3;}

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Unary arithmetic operators --

GLM_FUNC_DECL mat<3, 2, T, P> & operator=(mat<3, 2, T, P> const & m) GLM_DEFAULT;
Expand Down
16 changes: 8 additions & 8 deletions glm/detail/type_mat3x3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ namespace glm
col_type value[3];

public:
// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Constructors --

GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR;
Expand Down Expand Up @@ -73,14 +81,6 @@ namespace glm
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<3, 4, T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x);

// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 3;}

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Unary arithmetic operators --

GLM_FUNC_DECL mat<3, 3, T, P> & operator=(mat<3, 3, T, P> const & m) GLM_DEFAULT;
Expand Down
16 changes: 8 additions & 8 deletions glm/detail/type_mat3x4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ namespace glm
col_type value[3];

public:
// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Constructors --

GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR;
Expand Down Expand Up @@ -74,14 +82,6 @@ namespace glm
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x);

// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 3;}

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Unary arithmetic operators --

GLM_FUNC_DECL mat<3, 4, T, P> & operator=(mat<3, 4, T, P> const & m) GLM_DEFAULT;
Expand Down
16 changes: 8 additions & 8 deletions glm/detail/type_mat4x2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ namespace glm
col_type value[4];

public:
// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Constructors --

GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR;
Expand Down Expand Up @@ -79,14 +87,6 @@ namespace glm
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<3, 4, T, P> const & x);

// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 4;}

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Unary arithmetic operators --

GLM_FUNC_DECL mat<4, 2, T, P> & operator=(mat<4, 2, T, P> const & m) GLM_DEFAULT;
Expand Down
16 changes: 8 additions & 8 deletions glm/detail/type_mat4x3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ namespace glm
col_type value[4];

public:
// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Constructors --

GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR;
Expand Down Expand Up @@ -79,14 +87,6 @@ namespace glm
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT mat(mat<3, 4, T, P> const & x);

// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 4;}

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;

// -- Unary arithmetic operators --

GLM_FUNC_DECL mat<4, 3, T, P> & operator=(mat<4, 3, T, P> const & m) GLM_DEFAULT;
Expand Down
2 changes: 1 addition & 1 deletion glm/detail/type_mat4x4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace glm
// -- Accesses --

typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 4;}
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}

GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
Expand Down
2 changes: 1 addition & 1 deletion glm/detail/type_vec1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace glm

/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 1;}
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 1;}

GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
Expand Down
2 changes: 1 addition & 1 deletion glm/detail/type_vec2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace glm

/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 2;}
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;}

GLM_FUNC_DECL T& operator[](length_type i);
GLM_FUNC_DECL T const& operator[](length_type i) const;
Expand Down
2 changes: 1 addition & 1 deletion glm/detail/type_vec3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace glm

/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 3;}
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 3;}

GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
Expand Down
2 changes: 1 addition & 1 deletion glm/detail/type_vec4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace glm

/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL static length_type length(){return 4;}
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}

GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
Expand Down
2 changes: 1 addition & 1 deletion glm/gtc/quaternion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace glm

typedef length_t length_type;
/// Return the count of components of a quaternion
GLM_FUNC_DECL static length_type length(){return 4;}
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}

GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
Expand Down
2 changes: 1 addition & 1 deletion glm/gtx/dual_quaternion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace glm

typedef length_t length_type;
/// Return the count of components of a dual quaternion
GLM_FUNC_DECL static length_type length(){return 2;}
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;}

GLM_FUNC_DECL part_type & operator[](length_type i);
GLM_FUNC_DECL part_type const & operator[](length_type i) const;
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Removed GCC shadow warnings #595
- Added error for including of different versions of GLM #619
- Added GLM_FORCE_IGNORE_VERSION to ignore error caused by including different version of GLM #619
- Reduced warnings when using very strict compilation flags #646
- Reduced warnings when using very strict compilation flags #646
- length() member functions are constexpr #657
#### Fixes:
- Removed doxygen references to GTC_half_float which was removed in 0.9.4
Expand Down

0 comments on commit 1b78e2b

Please sign in to comment.