Browse Source

hashed string: warnings to clarify that it does not take ownerships of the string or copy it (close #798)

Michele Caini 4 years ago
parent
commit
58b1e2fb98
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/entt/core/hashed_string.hpp

+ 8 - 0
src/entt/core/hashed_string.hpp

@@ -48,6 +48,10 @@ struct fnv1a_traits<std::uint64_t> {
  * Because of that, a hashed string can also be used in constant expressions if
  * Because of that, a hashed string can also be used in constant expressions if
  * required.
  * required.
  *
  *
+ * @warning
+ * This class doesn't take ownership of user-supplied strings nor does it make a
+ * copy of them.
+ *
  * @tparam Char Character type.
  * @tparam Char Character type.
  */
  */
 template<typename Char>
 template<typename Char>
@@ -145,6 +149,10 @@ public:
     /**
     /**
      * @brief Explicit constructor on purpose to avoid constructing a hashed
      * @brief Explicit constructor on purpose to avoid constructing a hashed
      * string directly from a `const value_type *`.
      * string directly from a `const value_type *`.
+     *
+     * @warning
+     * The lifetime of the string is not extended nor is it copied.
+     *
      * @param wrapper Helps achieving the purpose by relying on overloading.
      * @param wrapper Helps achieving the purpose by relying on overloading.
      */
      */
     explicit constexpr basic_hashed_string(const_wrapper wrapper) ENTT_NOEXCEPT
     explicit constexpr basic_hashed_string(const_wrapper wrapper) ENTT_NOEXCEPT