diff --git a/sprout/pit/pit.hpp b/sprout/pit/pit.hpp index b1ba31c3..ef9ca421 100644 --- a/sprout/pit/pit.hpp +++ b/sprout/pit/pit.hpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace sprout { // @@ -53,6 +54,22 @@ namespace sprout { explicit SPROUT_CONSTEXPR pit(value_type const& t) : elem(t) {} + SPROUT_CXX14_CONSTEXPR pit& operator=(pit const& rhs) { + elem = rhs.elem; + return *this; + } + SPROUT_CXX14_CONSTEXPR pit& operator=(pit&& rhs) { + elem = sprout::move(rhs.elem); + return *this; + } + SPROUT_CXX14_CONSTEXPR pit& operator=(value_type const& rhs) { + elem = rhs; + return *this; + } + SPROUT_CXX14_CONSTEXPR pit& operator=(value_type&& rhs) { + elem = sprout::move(rhs); + return *this; + } SPROUT_CXX14_CONSTEXPR void swap(pit& other) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(elem, other.elem))) { diff --git a/sprout/sub_array/sub_array.hpp b/sprout/sub_array/sub_array.hpp index e4d561b9..4c4f45ab 100644 --- a/sprout/sub_array/sub_array.hpp +++ b/sprout/sub_array/sub_array.hpp @@ -109,7 +109,12 @@ namespace sprout { impl_difference_type to_first_; impl_difference_type to_last_; public: - sub_array_impl() = default; + SPROUT_CONSTEXPR sub_array_impl() + : array_() + , to_first_() + , to_last_() + {} + sub_array_impl(sub_array_impl const&) = default; protected: template SPROUT_CONSTEXPR sub_array_impl( @@ -207,6 +212,7 @@ namespace sprout { public: // construct/copy/destroy: sub_array() = default; + sub_array(sub_array const&) = default; SPROUT_CONSTEXPR sub_array(param_type arr, const_iterator first, const_iterator last) : impl_type( array_tag(), @@ -243,6 +249,20 @@ namespace sprout { other.to_first_ + to_last ) {} + template + SPROUT_CXX14_CONSTEXPR sub_array& operator=(sub_array const& rhs) { + array_ = rhs.array_; + to_first_ = rhs.to_first_; + to_last_ = rhs.to_last_; + return *this; + } + template + SPROUT_CXX14_CONSTEXPR sub_array& operator=(sub_array&& rhs) { + array_ = sprout::move(rhs.array_); + to_first_ = sprout::move(rhs.to_first_); + to_last_ = sprout::move(rhs.to_last_); + return *this; + } SPROUT_CXX14_CONSTEXPR void fill(const_reference value) { sprout::fill_n(begin(), size(), value); @@ -321,20 +341,6 @@ namespace sprout { return get_array().data() + to_first_; } // others: - template - SPROUT_CXX14_CONSTEXPR sub_array& operator=(sub_array const& rhs) { - array_ = rhs.array_; - to_first_ = rhs.to_first_; - to_last_ = rhs.to_last_; - return *this; - } - template - SPROUT_CXX14_CONSTEXPR sub_array& operator=(sub_array&& rhs) { - array_ = sprout::move(rhs.array_); - to_first_ = sprout::move(rhs.to_first_); - to_last_ = sprout::move(rhs.to_last_); - return *this; - } SPROUT_CXX14_CONSTEXPR pointer c_array() { return data(); }