diff options
-rw-r--r-- | include/jau/math/vec2f.hpp | 6 | ||||
-rw-r--r-- | include/jau/math/vec2i.hpp | 6 | ||||
-rw-r--r-- | include/jau/math/vec3f.hpp | 6 | ||||
-rw-r--r-- | include/jau/math/vec4f.hpp | 6 |
4 files changed, 24 insertions, 0 deletions
diff --git a/include/jau/math/vec2f.hpp b/include/jau/math/vec2f.hpp index 598d01e..9a830f7 100644 --- a/include/jau/math/vec2f.hpp +++ b/include/jau/math/vec2f.hpp @@ -86,12 +86,18 @@ namespace jau::math { return (&x)[i]; } + explicit operator const_pointer() const noexcept { return &x; } + constexpr const_iterator cbegin() const noexcept { return &x; } + /** Returns writeable reference to component */ constexpr reference operator[](size_t i) noexcept { assert(i < 2); return (&x)[i]; } + explicit operator pointer() noexcept { return &x; } + constexpr iterator begin() noexcept { return &x; } + /** xy = this, returns xy. */ constexpr iterator get(iterator xy) const noexcept { xy[0] = x; diff --git a/include/jau/math/vec2i.hpp b/include/jau/math/vec2i.hpp index 17e84de..ec6e237 100644 --- a/include/jau/math/vec2i.hpp +++ b/include/jau/math/vec2i.hpp @@ -83,12 +83,18 @@ namespace jau::math { return (&x)[i]; } + explicit operator const_pointer() const noexcept { return &x; } + constexpr const_iterator cbegin() const noexcept { return &x; } + /** Returns writeable reference to component */ constexpr reference operator[](size_t i) noexcept { assert(i < 2); return (&x)[i]; } + explicit operator pointer() noexcept { return &x; } + constexpr iterator begin() noexcept { return &x; } + /** xy = this, returns xy. */ constexpr iterator get(iterator xy) const noexcept { xy[0] = x; diff --git a/include/jau/math/vec3f.hpp b/include/jau/math/vec3f.hpp index b63a405..c68b45c 100644 --- a/include/jau/math/vec3f.hpp +++ b/include/jau/math/vec3f.hpp @@ -96,12 +96,18 @@ namespace jau::math { return (&x)[i]; } + explicit operator const_pointer() const noexcept { return &x; } + constexpr const_iterator cbegin() const noexcept { return &x; } + /** Returns writeable reference to component */ constexpr reference operator[](size_t i) noexcept { assert(i < 3); return (&x)[i]; } + explicit operator pointer() noexcept { return &x; } + constexpr iterator begin() noexcept { return &x; } + /** xyz = this, returns xyz. */ constexpr iterator get(iterator xyz) const noexcept { xyz[0] = x; diff --git a/include/jau/math/vec4f.hpp b/include/jau/math/vec4f.hpp index 2580c17..b27c767 100644 --- a/include/jau/math/vec4f.hpp +++ b/include/jau/math/vec4f.hpp @@ -97,12 +97,18 @@ namespace jau::math { return (&x)[i]; } + explicit operator const_pointer() const noexcept { return &x; } + constexpr const_iterator cbegin() const noexcept { return &x; } + /** Returns writeable reference to component */ constexpr reference operator[](size_t i) noexcept { assert(i < 4); return (&x)[i]; } + explicit operator pointer() noexcept { return &x; } + constexpr iterator begin() noexcept { return &x; } + /** xyzw = this, returns xyzw. */ constexpr iterator get(iterator xyzw) const noexcept { xyzw[0] = x; |