Browse Source

iterator: constexpr-ness all the way (see #883)

Michele Caini 3 years ago
parent
commit
86d86c3044
1 changed files with 10 additions and 10 deletions
  1. 10 10
      src/entt/core/iterator.hpp

+ 10 - 10
src/entt/core/iterator.hpp

@@ -21,13 +21,13 @@ struct input_iterator_pointer final {
     input_iterator_pointer(const input_iterator_pointer &) = delete;
     input_iterator_pointer(const input_iterator_pointer &) = delete;
 
 
     /*! @brief Default move constructor. */
     /*! @brief Default move constructor. */
-    input_iterator_pointer(input_iterator_pointer &&) = default;
+    constexpr input_iterator_pointer(input_iterator_pointer &&) = default;
 
 
     /**
     /**
      * @brief Constructs a proxy object by move.
      * @brief Constructs a proxy object by move.
      * @param val Value to use to initialize the proxy object.
      * @param val Value to use to initialize the proxy object.
      */
      */
-    input_iterator_pointer(Type &&val)
+    constexpr input_iterator_pointer(Type &&val)
         : value{std::move(val)} {}
         : value{std::move(val)} {}
 
 
     /**
     /**
@@ -40,13 +40,13 @@ struct input_iterator_pointer final {
      * @brief Default move assignment operator.
      * @brief Default move assignment operator.
      * @return This proxy object.
      * @return This proxy object.
      */
      */
-    input_iterator_pointer &operator=(input_iterator_pointer &&) = default;
+    constexpr input_iterator_pointer &operator=(input_iterator_pointer &&) = default;
 
 
     /**
     /**
      * @brief Access operator for accessing wrapped values.
      * @brief Access operator for accessing wrapped values.
      * @return A pointer to the wrapped value.
      * @return A pointer to the wrapped value.
      */
      */
-    [[nodiscard]] pointer operator->() ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr pointer operator->() ENTT_NOEXCEPT {
         return std::addressof(value);
         return std::addressof(value);
     }
     }
 
 
@@ -69,7 +69,7 @@ struct iterable_adaptor final {
     using sentinel = Sentinel;
     using sentinel = Sentinel;
 
 
     /*! @brief Default constructor. */
     /*! @brief Default constructor. */
-    iterable_adaptor()
+    constexpr iterable_adaptor()
         : first{},
         : first{},
           last{} {}
           last{} {}
 
 
@@ -78,7 +78,7 @@ struct iterable_adaptor final {
      * @param from Begin iterator.
      * @param from Begin iterator.
      * @param to End iterator.
      * @param to End iterator.
      */
      */
-    iterable_adaptor(iterator from, sentinel to)
+    constexpr iterable_adaptor(iterator from, sentinel to)
         : first{from},
         : first{from},
           last{to} {}
           last{to} {}
 
 
@@ -86,7 +86,7 @@ struct iterable_adaptor final {
      * @brief Returns an iterator to the beginning.
      * @brief Returns an iterator to the beginning.
      * @return An iterator to the first element of the range.
      * @return An iterator to the first element of the range.
      */
      */
-    [[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr iterator begin() const ENTT_NOEXCEPT {
         return first;
         return first;
     }
     }
 
 
@@ -95,17 +95,17 @@ struct iterable_adaptor final {
      * @return An iterator to the element following the last element of the
      * @return An iterator to the element following the last element of the
      * range.
      * range.
      */
      */
-    [[nodiscard]] sentinel end() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr sentinel end() const ENTT_NOEXCEPT {
         return last;
         return last;
     }
     }
 
 
     /*! @copydoc begin */
     /*! @copydoc begin */
-    [[nodiscard]] iterator cbegin() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr iterator cbegin() const ENTT_NOEXCEPT {
         return begin();
         return begin();
     }
     }
 
 
     /*! @copydoc end */
     /*! @copydoc end */
-    [[nodiscard]] sentinel cend() const ENTT_NOEXCEPT {
+    [[nodiscard]] constexpr sentinel cend() const ENTT_NOEXCEPT {
         return end();
         return end();
     }
     }