Browse Source

container: constexpr all the way (see #883)

Michele Caini 3 years ago
parent
commit
de6b2e139b
2 changed files with 68 additions and 68 deletions
  1. 34 34
      src/entt/container/dense_map.hpp
  2. 34 34
      src/entt/container/dense_set.hpp

+ 34 - 34
src/entt/container/dense_map.hpp

@@ -71,109 +71,109 @@ public:
     using difference_type = std::ptrdiff_t;
     using difference_type = std::ptrdiff_t;
     using iterator_category = std::input_iterator_tag;
     using iterator_category = std::input_iterator_tag;
 
 
-    dense_map_iterator() ENTT_NOEXCEPT
+    constexpr dense_map_iterator() ENTT_NOEXCEPT
         : it{} {}
         : it{} {}
 
 
-    dense_map_iterator(const It iter) ENTT_NOEXCEPT
+    constexpr dense_map_iterator(const It iter) ENTT_NOEXCEPT
         : it{iter} {}
         : it{iter} {}
 
 
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
-    dense_map_iterator(const dense_map_iterator<Other> &other) ENTT_NOEXCEPT
+    constexpr dense_map_iterator(const dense_map_iterator<Other> &other) ENTT_NOEXCEPT
         : it{other.it} {}
         : it{other.it} {}
 
 
-    dense_map_iterator &operator++() ENTT_NOEXCEPT {
+    constexpr dense_map_iterator &operator++() ENTT_NOEXCEPT {
         return ++it, *this;
         return ++it, *this;
     }
     }
 
 
-    dense_map_iterator operator++(int) ENTT_NOEXCEPT {
+    constexpr dense_map_iterator operator++(int) ENTT_NOEXCEPT {
         dense_map_iterator orig = *this;
         dense_map_iterator orig = *this;
         return ++(*this), orig;
         return ++(*this), orig;
     }
     }
 
 
-    dense_map_iterator &operator--() ENTT_NOEXCEPT {
+    constexpr dense_map_iterator &operator--() ENTT_NOEXCEPT {
         return --it, *this;
         return --it, *this;
     }
     }
 
 
-    dense_map_iterator operator--(int) ENTT_NOEXCEPT {
+    constexpr dense_map_iterator operator--(int) ENTT_NOEXCEPT {
         dense_map_iterator orig = *this;
         dense_map_iterator orig = *this;
         return operator--(), orig;
         return operator--(), orig;
     }
     }
 
 
-    dense_map_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
+    constexpr dense_map_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
         it += value;
         it += value;
         return *this;
         return *this;
     }
     }
 
 
-    dense_map_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
+    constexpr dense_map_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
         dense_map_iterator copy = *this;
         dense_map_iterator copy = *this;
         return (copy += value);
         return (copy += value);
     }
     }
 
 
-    dense_map_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
+    constexpr dense_map_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
         return (*this += -value);
         return (*this += -value);
     }
     }
 
 
-    dense_map_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
+    constexpr dense_map_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
         return (*this + -value);
         return (*this + -value);
     }
     }
 
 
-    [[nodiscard]] reference operator[](const difference_type value) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr reference operator[](const difference_type value) const ENTT_NOEXCEPT {
         return {it[value].element.first, it[value].element.second};
         return {it[value].element.first, it[value].element.second};
     }
     }
 
 
-    [[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
         return operator*();
         return operator*();
     }
     }
 
 
-    [[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
         return {it->element.first, it->element.second};
         return {it->element.first, it->element.second};
     }
     }
 
 
     template<typename ILhs, typename IRhs>
     template<typename ILhs, typename IRhs>
-    friend std::ptrdiff_t operator-(const dense_map_iterator<ILhs> &, const dense_map_iterator<IRhs> &) ENTT_NOEXCEPT;
+    friend constexpr std::ptrdiff_t operator-(const dense_map_iterator<ILhs> &, const dense_map_iterator<IRhs> &) ENTT_NOEXCEPT;
 
 
     template<typename ILhs, typename IRhs>
     template<typename ILhs, typename IRhs>
-    friend bool operator==(const dense_map_iterator<ILhs> &, const dense_map_iterator<IRhs> &) ENTT_NOEXCEPT;
+    friend constexpr bool operator==(const dense_map_iterator<ILhs> &, const dense_map_iterator<IRhs> &) ENTT_NOEXCEPT;
 
 
     template<typename ILhs, typename IRhs>
     template<typename ILhs, typename IRhs>
-    friend bool operator<(const dense_map_iterator<ILhs> &, const dense_map_iterator<IRhs> &) ENTT_NOEXCEPT;
+    friend constexpr bool operator<(const dense_map_iterator<ILhs> &, const dense_map_iterator<IRhs> &) ENTT_NOEXCEPT;
 
 
 private:
 private:
     It it;
     It it;
 };
 };
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] std::ptrdiff_t operator-(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr std::ptrdiff_t operator-(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return lhs.it - rhs.it;
     return lhs.it - rhs.it;
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator==(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator==(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return lhs.it == rhs.it;
     return lhs.it == rhs.it;
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator!=(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator!=(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return !(lhs == rhs);
     return !(lhs == rhs);
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator<(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator<(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return lhs.it < rhs.it;
     return lhs.it < rhs.it;
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator>(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator>(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return rhs < lhs;
     return rhs < lhs;
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator<=(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator<=(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return !(lhs > rhs);
     return !(lhs > rhs);
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator>=(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator>=(const dense_map_iterator<ILhs> &lhs, const dense_map_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return !(lhs < rhs);
     return !(lhs < rhs);
 }
 }
 
 
@@ -192,37 +192,37 @@ public:
     using difference_type = std::ptrdiff_t;
     using difference_type = std::ptrdiff_t;
     using iterator_category = std::input_iterator_tag;
     using iterator_category = std::input_iterator_tag;
 
 
-    dense_map_local_iterator() ENTT_NOEXCEPT
+    constexpr dense_map_local_iterator() ENTT_NOEXCEPT
         : it{},
         : it{},
           offset{} {}
           offset{} {}
 
 
-    dense_map_local_iterator(It iter, const std::size_t pos) ENTT_NOEXCEPT
+    constexpr dense_map_local_iterator(It iter, const std::size_t pos) ENTT_NOEXCEPT
         : it{iter},
         : it{iter},
           offset{pos} {}
           offset{pos} {}
 
 
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
-    dense_map_local_iterator(const dense_map_local_iterator<Other> &other) ENTT_NOEXCEPT
+    constexpr dense_map_local_iterator(const dense_map_local_iterator<Other> &other) ENTT_NOEXCEPT
         : it{other.it},
         : it{other.it},
           offset{other.offset} {}
           offset{other.offset} {}
 
 
-    dense_map_local_iterator &operator++() ENTT_NOEXCEPT {
+    constexpr dense_map_local_iterator &operator++() ENTT_NOEXCEPT {
         return offset = it[offset].next, *this;
         return offset = it[offset].next, *this;
     }
     }
 
 
-    dense_map_local_iterator operator++(int) ENTT_NOEXCEPT {
+    constexpr dense_map_local_iterator operator++(int) ENTT_NOEXCEPT {
         dense_map_local_iterator orig = *this;
         dense_map_local_iterator orig = *this;
         return ++(*this), orig;
         return ++(*this), orig;
     }
     }
 
 
-    [[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
         return operator*();
         return operator*();
     }
     }
 
 
-    [[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
         return {it[offset].element.first, it[offset].element.second};
         return {it[offset].element.first, it[offset].element.second};
     }
     }
 
 
-    [[nodiscard]] std::size_t index() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr std::size_t index() const ENTT_NOEXCEPT {
         return offset;
         return offset;
     }
     }
 
 
@@ -232,12 +232,12 @@ private:
 };
 };
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator==(const dense_map_local_iterator<ILhs> &lhs, const dense_map_local_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator==(const dense_map_local_iterator<ILhs> &lhs, const dense_map_local_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return lhs.index() == rhs.index();
     return lhs.index() == rhs.index();
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator!=(const dense_map_local_iterator<ILhs> &lhs, const dense_map_local_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator!=(const dense_map_local_iterator<ILhs> &lhs, const dense_map_local_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return !(lhs == rhs);
     return !(lhs == rhs);
 }
 }
 
 

+ 34 - 34
src/entt/container/dense_set.hpp

@@ -39,109 +39,109 @@ public:
     using difference_type = std::ptrdiff_t;
     using difference_type = std::ptrdiff_t;
     using iterator_category = std::random_access_iterator_tag;
     using iterator_category = std::random_access_iterator_tag;
 
 
-    dense_set_iterator() ENTT_NOEXCEPT
+    constexpr dense_set_iterator() ENTT_NOEXCEPT
         : it{} {}
         : it{} {}
 
 
-    dense_set_iterator(const It iter) ENTT_NOEXCEPT
+    constexpr dense_set_iterator(const It iter) ENTT_NOEXCEPT
         : it{iter} {}
         : it{iter} {}
 
 
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
-    dense_set_iterator(const dense_set_iterator<Other> &other) ENTT_NOEXCEPT
+    constexpr dense_set_iterator(const dense_set_iterator<Other> &other) ENTT_NOEXCEPT
         : it{other.it} {}
         : it{other.it} {}
 
 
-    dense_set_iterator &operator++() ENTT_NOEXCEPT {
+    constexpr dense_set_iterator &operator++() ENTT_NOEXCEPT {
         return ++it, *this;
         return ++it, *this;
     }
     }
 
 
-    dense_set_iterator operator++(int) ENTT_NOEXCEPT {
+    constexpr dense_set_iterator operator++(int) ENTT_NOEXCEPT {
         dense_set_iterator orig = *this;
         dense_set_iterator orig = *this;
         return ++(*this), orig;
         return ++(*this), orig;
     }
     }
 
 
-    dense_set_iterator &operator--() ENTT_NOEXCEPT {
+    constexpr dense_set_iterator &operator--() ENTT_NOEXCEPT {
         return --it, *this;
         return --it, *this;
     }
     }
 
 
-    dense_set_iterator operator--(int) ENTT_NOEXCEPT {
+    constexpr dense_set_iterator operator--(int) ENTT_NOEXCEPT {
         dense_set_iterator orig = *this;
         dense_set_iterator orig = *this;
         return operator--(), orig;
         return operator--(), orig;
     }
     }
 
 
-    dense_set_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
+    constexpr dense_set_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
         it += value;
         it += value;
         return *this;
         return *this;
     }
     }
 
 
-    dense_set_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
+    constexpr dense_set_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
         dense_set_iterator copy = *this;
         dense_set_iterator copy = *this;
         return (copy += value);
         return (copy += value);
     }
     }
 
 
-    dense_set_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
+    constexpr dense_set_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
         return (*this += -value);
         return (*this += -value);
     }
     }
 
 
-    dense_set_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
+    constexpr dense_set_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
         return (*this + -value);
         return (*this + -value);
     }
     }
 
 
-    [[nodiscard]] reference operator[](const difference_type value) const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr reference operator[](const difference_type value) const ENTT_NOEXCEPT {
         return it[value].second;
         return it[value].second;
     }
     }
 
 
-    [[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
         return std::addressof(it->second);
         return std::addressof(it->second);
     }
     }
 
 
-    [[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
         return *operator->();
         return *operator->();
     }
     }
 
 
     template<typename ILhs, typename IRhs>
     template<typename ILhs, typename IRhs>
-    friend std::ptrdiff_t operator-(const dense_set_iterator<ILhs> &, const dense_set_iterator<IRhs> &) ENTT_NOEXCEPT;
+    friend constexpr std::ptrdiff_t operator-(const dense_set_iterator<ILhs> &, const dense_set_iterator<IRhs> &) ENTT_NOEXCEPT;
 
 
     template<typename ILhs, typename IRhs>
     template<typename ILhs, typename IRhs>
-    friend bool operator==(const dense_set_iterator<ILhs> &, const dense_set_iterator<IRhs> &) ENTT_NOEXCEPT;
+    friend constexpr bool operator==(const dense_set_iterator<ILhs> &, const dense_set_iterator<IRhs> &) ENTT_NOEXCEPT;
 
 
     template<typename ILhs, typename IRhs>
     template<typename ILhs, typename IRhs>
-    friend bool operator<(const dense_set_iterator<ILhs> &, const dense_set_iterator<IRhs> &) ENTT_NOEXCEPT;
+    friend constexpr bool operator<(const dense_set_iterator<ILhs> &, const dense_set_iterator<IRhs> &) ENTT_NOEXCEPT;
 
 
 private:
 private:
     It it;
     It it;
 };
 };
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] std::ptrdiff_t operator-(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr std::ptrdiff_t operator-(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return lhs.it - rhs.it;
     return lhs.it - rhs.it;
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator==(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator==(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return lhs.it == rhs.it;
     return lhs.it == rhs.it;
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator!=(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator!=(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return !(lhs == rhs);
     return !(lhs == rhs);
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator<(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator<(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return lhs.it < rhs.it;
     return lhs.it < rhs.it;
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator>(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator>(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return rhs < lhs;
     return rhs < lhs;
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator<=(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator<=(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return !(lhs > rhs);
     return !(lhs > rhs);
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator>=(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator>=(const dense_set_iterator<ILhs> &lhs, const dense_set_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return !(lhs < rhs);
     return !(lhs < rhs);
 }
 }
 
 
@@ -157,37 +157,37 @@ public:
     using difference_type = std::ptrdiff_t;
     using difference_type = std::ptrdiff_t;
     using iterator_category = std::forward_iterator_tag;
     using iterator_category = std::forward_iterator_tag;
 
 
-    dense_set_local_iterator() ENTT_NOEXCEPT
+    constexpr dense_set_local_iterator() ENTT_NOEXCEPT
         : it{},
         : it{},
           offset{} {}
           offset{} {}
 
 
-    dense_set_local_iterator(It iter, const std::size_t pos) ENTT_NOEXCEPT
+    constexpr dense_set_local_iterator(It iter, const std::size_t pos) ENTT_NOEXCEPT
         : it{iter},
         : it{iter},
           offset{pos} {}
           offset{pos} {}
 
 
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
     template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
-    dense_set_local_iterator(const dense_set_local_iterator<Other> &other) ENTT_NOEXCEPT
+    constexpr dense_set_local_iterator(const dense_set_local_iterator<Other> &other) ENTT_NOEXCEPT
         : it{other.it},
         : it{other.it},
           offset{other.offset} {}
           offset{other.offset} {}
 
 
-    dense_set_local_iterator &operator++() ENTT_NOEXCEPT {
+    constexpr dense_set_local_iterator &operator++() ENTT_NOEXCEPT {
         return offset = it[offset].first, *this;
         return offset = it[offset].first, *this;
     }
     }
 
 
-    dense_set_local_iterator operator++(int) ENTT_NOEXCEPT {
+    constexpr dense_set_local_iterator operator++(int) ENTT_NOEXCEPT {
         dense_set_local_iterator orig = *this;
         dense_set_local_iterator orig = *this;
         return ++(*this), orig;
         return ++(*this), orig;
     }
     }
 
 
-    [[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
         return std::addressof(it[offset].second);
         return std::addressof(it[offset].second);
     }
     }
 
 
-    [[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
         return *operator->();
         return *operator->();
     }
     }
 
 
-    [[nodiscard]] std::size_t index() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr std::size_t index() const ENTT_NOEXCEPT {
         return offset;
         return offset;
     }
     }
 
 
@@ -197,12 +197,12 @@ private:
 };
 };
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator==(const dense_set_local_iterator<ILhs> &lhs, const dense_set_local_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator==(const dense_set_local_iterator<ILhs> &lhs, const dense_set_local_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return lhs.index() == rhs.index();
     return lhs.index() == rhs.index();
 }
 }
 
 
 template<typename ILhs, typename IRhs>
 template<typename ILhs, typename IRhs>
-[[nodiscard]] bool operator!=(const dense_set_local_iterator<ILhs> &lhs, const dense_set_local_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr bool operator!=(const dense_set_local_iterator<ILhs> &lhs, const dense_set_local_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
     return !(lhs == rhs);
     return !(lhs == rhs);
 }
 }