summaryrefslogtreecommitdiff
path: root/src/ipa/libipa/vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/libipa/vector.h')
-rw-r--r--src/ipa/libipa/vector.h49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h
index 8612a06a..b91e50b2 100644
--- a/src/ipa/libipa/vector.h
+++ b/src/ipa/libipa/vector.h
@@ -53,30 +53,6 @@ public:
return data_[i];
}
-#ifndef __DOXYGEN__
- template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 1>>
-#endif /* __DOXYGEN__ */
- constexpr T x() const
- {
- return data_[0];
- }
-
-#ifndef __DOXYGEN__
- template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 2>>
-#endif /* __DOXYGEN__ */
- constexpr T y() const
- {
- return data_[1];
- }
-
-#ifndef __DOXYGEN__
- template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 3>>
-#endif /* __DOXYGEN__ */
- constexpr T z() const
- {
- return data_[2];
- }
-
constexpr Vector<T, Rows> operator-() const
{
Vector<T, Rows> ret;
@@ -125,6 +101,31 @@ public:
return ret;
}
+#ifndef __DOXYGEN__
+ template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 1>>
+#endif /* __DOXYGEN__ */
+ constexpr const T &x() const { return data_[0]; }
+#ifndef __DOXYGEN__
+ template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 2>>
+#endif /* __DOXYGEN__ */
+ constexpr const T &y() const { return data_[1]; }
+#ifndef __DOXYGEN__
+ template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 3>>
+#endif /* __DOXYGEN__ */
+ constexpr const T &z() const { return data_[2]; }
+#ifndef __DOXYGEN__
+ template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 1>>
+#endif /* __DOXYGEN__ */
+ constexpr T &x() { return data_[0]; }
+#ifndef __DOXYGEN__
+ template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 2>>
+#endif /* __DOXYGEN__ */
+ constexpr T &y() { return data_[1]; }
+#ifndef __DOXYGEN__
+ template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 3>>
+#endif /* __DOXYGEN__ */
+ constexpr T &z() { return data_[2]; }
+
constexpr double length2() const
{
double ret = 0;