From 4d05a9a8fa512f5c61fe0baff4c19633c41d0be9 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Thu, 17 Mar 2022 22:44:17 +0100 Subject: [PATCH] Added const versions of std::array::begin() and std::array::end() --- const_fmt/stdlib.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/const_fmt/stdlib.h b/const_fmt/stdlib.h index 026e01b..684f70a 100644 --- a/const_fmt/stdlib.h +++ b/const_fmt/stdlib.h @@ -240,7 +240,7 @@ public: constexpr array(const array&) = default; constexpr array(array&&) = default; - constexpr array& operator=(array& other) = default; + constexpr array& operator=(const array& other) = default; constexpr array& operator=(array&& other) = default; constexpr void swap(array& other) noexcept { @@ -271,6 +271,14 @@ public: return (&(m_data[t_size - 1]) + 1); } + constexpr const_iterator begin() const noexcept { + return &(m_data[0]); + } + + constexpr const_iterator end() const noexcept { + return (&(m_data[t_size - 1]) + 1); + } + constexpr const_iterator cbegin() const noexcept { return &(m_data[0]); }