Browse Source

monstate: return *this from operator=

Michele Caini 1 year ago
parent
commit
32ae3eef08
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/entt/core/monostate.hpp

+ 4 - 2
src/entt/core/monostate.hpp

@@ -23,10 +23,12 @@ struct monostate {
      * @brief Assigns a value of a specific type to a given key.
      * @brief Assigns a value of a specific type to a given key.
      * @tparam Type Type of the value to assign.
      * @tparam Type Type of the value to assign.
      * @param val User data to assign to the given key.
      * @param val User data to assign to the given key.
+     * @return This monostate object.
      */
      */
     template<typename Type>
     template<typename Type>
-    void operator=(Type val) const noexcept {
+    monostate &operator=(Type val) noexcept {
         value<Type> = val;
         value<Type> = val;
+        return *this;
     }
     }
 
 
     /**
     /**
@@ -49,7 +51,7 @@ private:
  * @tparam Value Value used to differentiate between different variables.
  * @tparam Value Value used to differentiate between different variables.
  */
  */
 template<id_type Value>
 template<id_type Value>
-inline monostate<Value> monostate_v = {};
+inline monostate<Value> monostate_v{};
 
 
 } // namespace entt
 } // namespace entt