From 29c2457549c98a17efa782d421de588ad716ba9c Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 15 Dec 2014 13:29:11 +1100 Subject: [PATCH] coord: add index accessor operators --- detail/coord.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/detail/coord.hpp b/detail/coord.hpp index 6c94be7c..c1e22882 100644 --- a/detail/coord.hpp +++ b/detail/coord.hpp @@ -43,6 +43,9 @@ namespace util { { ; } double data[S]; + + double& operator[] (size_t i) { return data[i]; } + double operator[] (size_t i) const { return data[i]; } }; template <> @@ -57,6 +60,9 @@ namespace util { double data[1]; double x; }; + + double& operator[] (size_t i) { return data[i]; } + double operator[] (size_t i) const { return data[i]; } }; template <> @@ -78,6 +84,9 @@ namespace util { double t; }; }; + + double& operator[] (size_t i) { return data[i]; } + double operator[] (size_t i) const { return data[i]; } }; template <> @@ -96,6 +105,9 @@ namespace util { template coord_data (T... t): data{t...} { ; } + + double& operator[] (size_t i) { return data[i]; } + double operator[] (size_t i) const { return data[i]; } }; template <> @@ -115,6 +127,9 @@ namespace util { template coord_data (T... t): data{t...} { ; } + + double& operator[] (size_t i) { return data[i]; } + double operator[] (size_t i) const { return data[i]; } }; #pragma GCC diagnostic pop }