Skip to content

Commit f0088ad

Browse files
committed
constexpr
1 parent 3f41947 commit f0088ad

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

src/r4/matrix.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ class matrix :
115115
*/
116116
template <typename enable_type = component_type>
117117
constexpr matrix(
118-
const quaternion<std::enable_if_t<num_rows == num_columns && (num_rows == 3 || num_rows == 4), enable_type>>&
119-
quat
118+
const quaternion<std::enable_if_t<num_rows == num_columns&&(num_rows == 3 || num_rows == 4), enable_type>>& quat
120119
) noexcept
121120
{
122121
this->set(quat);
@@ -210,8 +209,7 @@ class matrix :
210209
*/
211210
template <typename enable_type = component_type>
212211
matrix& set(
213-
const quaternion<std::enable_if_t<num_rows == num_columns && (num_rows == 3 || num_rows == 4), enable_type>>&
214-
quat
212+
const quaternion<std::enable_if_t<num_rows == num_columns&&(num_rows == 3 || num_rows == 4), enable_type>>& quat
215213
) noexcept
216214
{
217215
// Quaternion to matrix conversion:
@@ -914,7 +912,7 @@ class matrix :
914912
*/
915913
template <typename enable_type = component_type>
916914
matrix& rotate(
917-
const quaternion<std::enable_if_t<num_rows == num_columns && (num_rows == 3 || num_rows == 4), enable_type>>& q
915+
const quaternion<std::enable_if_t<num_rows == num_columns&&(num_rows == 3 || num_rows == 4), enable_type>>& q
918916
) noexcept
919917
{
920918
return this->operator*=(matrix<component_type, num_rows, num_columns>(q));

src/r4/vector.hpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,31 @@ class vector :
6363
/**
6464
* @brief First vector component.
6565
*/
66-
component_type& x() noexcept
66+
constexpr component_type& x() noexcept
6767
{
6868
return this->operator[](0);
6969
}
7070

7171
/**
7272
* @brief First vector component.
7373
*/
74-
const component_type& x() const noexcept
74+
constexpr const component_type& x() const noexcept
7575
{
7676
return this->operator[](0);
7777
}
7878

7979
/**
8080
* @brief First vector component.
8181
*/
82-
component_type& r() noexcept
82+
constexpr component_type& r() noexcept
8383
{
8484
return this->operator[](0);
8585
}
8686

8787
/**
8888
* @brief First vector component.
8989
*/
90-
const component_type& r() const noexcept
90+
constexpr const component_type& r() const noexcept
9191
{
9292
return this->operator[](0);
9393
}
@@ -96,7 +96,7 @@ class vector :
9696
* @brief Second vector component.
9797
*/
9898
template <typename enable_type = component_type>
99-
std::enable_if_t<(dimension > 1), enable_type&> y() noexcept
99+
constexpr std::enable_if_t<(dimension > 1), enable_type&> y() noexcept
100100
{
101101
return this->operator[](1);
102102
}
@@ -105,7 +105,7 @@ class vector :
105105
* @brief Second vector component.
106106
*/
107107
template <typename enable_type = component_type>
108-
std::enable_if_t<(dimension > 1), const enable_type&> y() const noexcept
108+
constexpr std::enable_if_t<(dimension > 1), const enable_type&> y() const noexcept
109109
{
110110
return this->operator[](1);
111111
}
@@ -114,7 +114,7 @@ class vector :
114114
* @brief Second vector component.
115115
*/
116116
template <typename enable_type = component_type>
117-
std::enable_if_t<(dimension > 1), enable_type&> g() noexcept
117+
constexpr std::enable_if_t<(dimension > 1), enable_type&> g() noexcept
118118
{
119119
return this->operator[](1);
120120
}
@@ -123,7 +123,7 @@ class vector :
123123
* @brief Second vector component.
124124
*/
125125
template <typename enable_type = component_type>
126-
std::enable_if_t<(dimension > 1), const enable_type&> g() const noexcept
126+
constexpr std::enable_if_t<(dimension > 1), const enable_type&> g() const noexcept
127127
{
128128
return this->operator[](1);
129129
}
@@ -132,7 +132,7 @@ class vector :
132132
* @brief Third vector component.
133133
*/
134134
template <typename enable_type = component_type>
135-
std::enable_if_t<(dimension > 2), enable_type&> z() noexcept
135+
constexpr std::enable_if_t<(dimension > 2), enable_type&> z() noexcept
136136
{
137137
return this->operator[](2);
138138
}
@@ -141,7 +141,7 @@ class vector :
141141
* @brief Third vector component.
142142
*/
143143
template <typename enable_type = component_type>
144-
std::enable_if_t<(dimension > 2), const enable_type&> z() const noexcept
144+
constexpr std::enable_if_t<(dimension > 2), const enable_type&> z() const noexcept
145145
{
146146
return this->operator[](2);
147147
}
@@ -150,7 +150,7 @@ class vector :
150150
* @brief Third vector component.
151151
*/
152152
template <typename enable_type = component_type>
153-
std::enable_if_t<(dimension > 2), enable_type&> b() noexcept
153+
constexpr std::enable_if_t<(dimension > 2), enable_type&> b() noexcept
154154
{
155155
return this->operator[](2);
156156
}
@@ -159,7 +159,7 @@ class vector :
159159
* @brief Third vector component.
160160
*/
161161
template <typename enable_type = component_type>
162-
std::enable_if_t<(dimension > 2), const enable_type&> b() const noexcept
162+
constexpr std::enable_if_t<(dimension > 2), const enable_type&> b() const noexcept
163163
{
164164
return this->operator[](2);
165165
}
@@ -168,7 +168,7 @@ class vector :
168168
* @brief Fourth vector component.
169169
*/
170170
template <typename enable_type = component_type>
171-
std::enable_if_t<(dimension > 3), enable_type&> w() noexcept
171+
constexpr std::enable_if_t<(dimension > 3), enable_type&> w() noexcept
172172
{
173173
return this->operator[](3);
174174
}
@@ -177,7 +177,7 @@ class vector :
177177
* @brief Fourth vector component.
178178
*/
179179
template <typename enable_type = component_type>
180-
std::enable_if_t<(dimension > 3), const enable_type&> w() const noexcept
180+
constexpr std::enable_if_t<(dimension > 3), const enable_type&> w() const noexcept
181181
{
182182
return this->operator[](3);
183183
}
@@ -186,7 +186,7 @@ class vector :
186186
* @brief Fourth vector component.
187187
*/
188188
template <typename enable_type = component_type>
189-
std::enable_if_t<(dimension > 3), enable_type&> a() noexcept
189+
constexpr std::enable_if_t<(dimension > 3), enable_type&> a() noexcept
190190
{
191191
return this->operator[](3);
192192
}
@@ -195,7 +195,7 @@ class vector :
195195
* @brief Fourth vector component.
196196
*/
197197
template <typename enable_type = component_type>
198-
std::enable_if_t<(dimension > 3), const enable_type&> a() const noexcept
198+
constexpr std::enable_if_t<(dimension > 3), const enable_type&> a() const noexcept
199199
{
200200
return this->operator[](3);
201201
}

tool-configs

0 commit comments

Comments
 (0)