diff --git a/libs/bitset/test/bitset.cpp b/libs/bitset/test/bitset.cpp index 7d960c3c..8bba991f 100644 --- a/libs/bitset/test/bitset.cpp +++ b/libs/bitset/test/bitset.cpp @@ -10,6 +10,7 @@ #include #include +#include #include namespace testspr { @@ -21,6 +22,19 @@ namespace testspr { // 20.5.2 bitset operations: + // operator= + { + auto bits = bitset_t(0xDEADBACE); + bits = bits1; + TESTSPR_ASSERT(bits == bits1); + } + { + auto bits2 = bits1; + auto bits = bitset_t(0xDEADBACE); + bits = sprout::move(bits2); + TESTSPR_ASSERT(bits == bits1); + } + // operator&= { auto bits = bits1; diff --git a/sprout/bitset/bitset.hpp b/sprout/bitset/bitset.hpp index 4de9063e..bb495f99 100644 --- a/sprout/bitset/bitset.hpp +++ b/sprout/bitset/bitset.hpp @@ -23,10 +23,13 @@ #include #include #include +#include +#include #include #include #include #include +#include #include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT @@ -227,6 +230,7 @@ namespace sprout { SPROUT_CONSTEXPR base_bitset() SPROUT_NOEXCEPT : w_() {} + base_bitset(base_bitset const&) = default; SPROUT_CONSTEXPR base_bitset(unsigned long long val) SPROUT_NOEXCEPT : w_{word_type(val), word_type(val >> (CHAR_BIT * sprout::detail::sizeof_::value))} {} @@ -234,6 +238,14 @@ namespace sprout { SPROUT_CONSTEXPR base_bitset(sprout::detail::base_bitset_from_words_construct_tag, Words... words) : w_{words...} {} + SPROUT_CXX14_CONSTEXPR base_bitset& operator=(base_bitset const& rhs) { + sprout::copy(rhs.w_ + 0, rhs.w_ + N, w_ + 0); + return *this; + } + SPROUT_CXX14_CONSTEXPR base_bitset& operator=(base_bitset&& rhs) { + sprout::move(rhs.w_ + 0, rhs.w_ + N, w_ + 0); + return *this; + } SPROUT_CXX14_CONSTEXPR void setword(std::size_t pos, word_type word) SPROUT_NOEXCEPT { @@ -506,12 +518,21 @@ namespace sprout { SPROUT_CONSTEXPR base_bitset() SPROUT_NOEXCEPT : w_(0) {} + base_bitset(base_bitset<1> const&) = default; SPROUT_CONSTEXPR base_bitset(unsigned long long val) SPROUT_NOEXCEPT : w_(val) {} SPROUT_CONSTEXPR base_bitset(sprout::detail::base_bitset_from_words_construct_tag, word_type word) : w_(word) {} + SPROUT_CXX14_CONSTEXPR base_bitset<1>& operator=(base_bitset<1> const& rhs) { + w_ = rhs.w_; + return *this; + } + SPROUT_CXX14_CONSTEXPR base_bitset<1>& operator=(base_bitset<1>&& rhs) { + w_ = sprout::move(rhs.w_); + return *this; + } SPROUT_CXX14_CONSTEXPR void setword(std::size_t, word_type word) SPROUT_NOEXCEPT { @@ -683,8 +704,15 @@ namespace sprout { } public: SPROUT_CONSTEXPR base_bitset() SPROUT_NOEXCEPT {} + base_bitset(base_bitset<0> const&) = default; SPROUT_CONSTEXPR base_bitset(unsigned long long) SPROUT_NOEXCEPT {} SPROUT_CONSTEXPR base_bitset(sprout::detail::base_bitset_from_words_construct_tag) {} + SPROUT_CXX14_CONSTEXPR base_bitset<0>& operator=(base_bitset<0> const& rhs) SPROUT_NOEXCEPT { + return *this; + } + SPROUT_CXX14_CONSTEXPR base_bitset<0>& operator=(base_bitset<0>&& rhs) SPROUT_NOEXCEPT { + return *this; + } SPROUT_CXX14_CONSTEXPR void setword(std::size_t, word_type) SPROUT_NOEXCEPT {} @@ -699,9 +727,8 @@ namespace sprout { SPROUT_CXX14_CONSTEXPR word_type getword(std::size_t, bool c = false) SPROUT_NOEXCEPT { -// typedef word_type* type; return !c ? 0 - : throw std::out_of_range("base_bitset::getword"), 0 + : throw std::out_of_range("base_bitset::getword") ; } SPROUT_CONSTEXPR word_type @@ -1074,7 +1101,10 @@ namespace sprout { } public: // 20.5.1 constructors: - SPROUT_CONSTEXPR bitset() SPROUT_NOEXCEPT {} + SPROUT_CONSTEXPR bitset() SPROUT_NOEXCEPT + : base_type() + {} + bitset(bitset const&) = default; SPROUT_CONSTEXPR bitset(unsigned long long val) SPROUT_NOEXCEPT : base_type(sprout::detail::sanitize_val::do_sanitize_val(val)) {} @@ -1126,6 +1156,16 @@ namespace sprout { } // 20.5.2 bitset operations: SPROUT_CXX14_CONSTEXPR bitset& + operator=(bitset const& rhs) { + base_type::operator=(rhs); + return *this; + } + SPROUT_CXX14_CONSTEXPR bitset& + operator=(bitset&& rhs) { + base_type::operator=(sprout::move(rhs)); + return *this; + } + SPROUT_CXX14_CONSTEXPR bitset& operator&=(bitset const& rhs) SPROUT_NOEXCEPT { this->do_and(rhs); return *this; diff --git a/sprout/forward_clist.hpp b/sprout/forward_clist.hpp index 36947c59..ff9332f5 100644 --- a/sprout/forward_clist.hpp +++ b/sprout/forward_clist.hpp @@ -221,6 +221,9 @@ namespace sprout { private: holder_type val; item_holder_type next; + private: + item& operator=(item const&) SPROUT_DELETED_FUNCTION_DECL + item& operator=(item&&) SPROUT_DELETED_FUNCTION_DECL private: item(item const&) = default; SPROUT_CONSTEXPR item(typename holder_type::argument_type p, item_holder_type const& n) @@ -232,9 +235,6 @@ namespace sprout { , next(n) {} - item& operator=(item const&) = default; - item& operator=(item&&) = default; - SPROUT_CXX14_CONSTEXPR void swap(item& other) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(val, other.val)) && SPROUT_NOEXCEPT_EXPR(sprout::swap(next, other.next))) {