浏览代码

hashed_string: literals are now enclosed within entt::literals, ENTT_HS_SUFFIX and ENTT_HWS_SUFFIX no longer exist (close #590)

Michele Caini 5 年之前
父节点
当前提交
90606bd410

+ 1 - 0
TODO

@@ -17,6 +17,7 @@
   - ...
 
 WIP:
+* suppress warnings in meta.hpp (uninitialized members)
 * make view pack work also with groups, add multi-type iterator (not only input iterators)
 * add exclude-only views to combine with packs
 * deprecate non-owning groups in favor of owning views and view packs, introduce lazy owning views

+ 5 - 12
docs/md/config.md

@@ -8,7 +8,6 @@
 * [Introduction](#introduction)
 * [Definitions](#definitions)
   * [ENTT_NOEXCEPT](#entt_noexcept)
-  * [ENTT_HS_SUFFIX and ENTT_HWS_SUFFIX](#entt_hs_suffix_and_entt_hws_suffix)
   * [ENTT_USE_ATOMIC](#entt_use_atomic)
   * [ENTT_ID_TYPE](#entt_id_type)
   * [ENTT_PAGE_SIZE](#entt_page_size)
@@ -43,13 +42,6 @@ The purpose of this parameter is to suppress the use of `noexcept` by this
 library.<br/>
 To do this, simply define the variable without assigning any value to it.
 
-## ENTT_HS_SUFFIX and ENTT_HWS_SUFFIX
-
-The `hashed_string` class introduces the `_hs` and `_hws` suffixes to accompany
-its user defined literals.<br/>
-In the case of conflicts or even just to change these suffixes, it's possible to
-do so by associating new ones with these definitions.
-
 ## ENTT_USE_ATOMIC
 
 In general, `EnTT` doesn't offer primitives to support multi-threading. Many of
@@ -93,8 +85,9 @@ dedicated storage for them.
 
 ## ENTT_STANDARD_CPP
 
-After many adventures, `EnTT` finally works fine across boundaries.<br/>
-To do this, the library mixes some non-standard language features with others
-that are perfectly compliant.<br/>
+`EnTT` mixes non-standard language features with others that are perfectly
+compliant to offer some of its functionalities.<br/>
 This definition will prevent the library from using non-standard techniques,
-that is, functionalities that aren't fully compliant with the standard C++.
+that is, functionalities that aren't fully compliant with the standard C++.<br/>
+While there are no known portability issues at the time of this writing, this
+should make the library fully portable anyway if needed.

+ 9 - 0
docs/md/core.md

@@ -137,9 +137,14 @@ There is also a _user defined literal_ dedicated to hashed strings to make them
 more user-friendly:
 
 ```cpp
+using namespace entt::literals;
 constexpr auto str = "text"_hs;
 ```
 
+To use it, remember that all user defined literals in `EnTT` are enclosed in the
+`entt::literals` namespace. Therefore, the entire namespace or selectively the
+literal of interest must be explicitly included before each use, a bit like
+`std::literals`.<br/>
 Finally, in case users need to create hashed strings at runtime, this class also
 offers the necessary functionalities:
 
@@ -153,6 +158,10 @@ entt::hashed_string str{orig.c_str()};
 const auto hash = entt::hashed_string::value(orig.c_str());
 ```
 
+This possibility shouldn't be exploited in tight loops, since the computation
+takes place at runtime and no longer at compile-time and could therefore impact
+performance to some degrees.
+
 ## Wide characters
 
 The hashed string has a design that is close to that of an `std::basic_string`.

+ 0 - 10
src/entt/config/config.h

@@ -7,16 +7,6 @@
 #endif
 
 
-#ifndef ENTT_HS_SUFFIX
-#   define ENTT_HS_SUFFIX _hs
-#endif
-
-
-#ifndef ENTT_HWS_SUFFIX
-#   define ENTT_HWS_SUFFIX _hws
-#endif
-
-
 #ifndef ENTT_USE_ATOMIC
 #   define ENTT_MAYBE_ATOMIC(Type) Type
 #else

+ 9 - 3
src/entt/core/hashed_string.hpp

@@ -237,7 +237,7 @@ using hashed_string = basic_hashed_string<char>;
 using hashed_wstring = basic_hashed_string<wchar_t>;
 
 
-}
+inline namespace literals {
 
 
 /**
@@ -245,7 +245,7 @@ using hashed_wstring = basic_hashed_string<wchar_t>;
  * @param str The literal without its suffix.
  * @return A properly initialized hashed string.
  */
-[[nodiscard]] constexpr entt::hashed_string operator"" ENTT_HS_SUFFIX(const char *str, std::size_t) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr entt::hashed_string operator"" _hs(const char *str, std::size_t) ENTT_NOEXCEPT {
     return entt::hashed_string{str};
 }
 
@@ -255,9 +255,15 @@ using hashed_wstring = basic_hashed_string<wchar_t>;
  * @param str The literal without its suffix.
  * @return A properly initialized hashed wstring.
  */
-[[nodiscard]] constexpr entt::hashed_wstring operator"" ENTT_HWS_SUFFIX(const wchar_t *str, std::size_t) ENTT_NOEXCEPT {
+[[nodiscard]] constexpr entt::hashed_wstring operator"" _hws(const wchar_t *str, std::size_t) ENTT_NOEXCEPT {
     return entt::hashed_wstring{str};
 }
 
 
+}
+
+
+}
+
+
 #endif

+ 4 - 0
test/entt/core/hashed_string.cpp

@@ -10,6 +10,7 @@ TEST(BasicHashedString, DeductionGuide) {
 }
 
 TEST(HashedString, Functionalities) {
+    using namespace entt::literals;
     using hash_type = entt::hashed_string::hash_type;
 
     const char *bar = "bar";
@@ -54,6 +55,7 @@ TEST(HashedString, Correctness) {
 }
 
 TEST(HashedString, Constexprness) {
+    using namespace entt::literals;
     constexpr std::string_view view{"foobar__", 6};
 
     static_assert(entt::hashed_string{"quux"} == "quux"_hs);
@@ -67,6 +69,7 @@ TEST(HashedString, Constexprness) {
 }
 
 TEST(HashedWString, Functionalities) {
+    using namespace entt::literals;
     using hash_type = entt::hashed_wstring::hash_type;
 
     const wchar_t *bar = L"bar";
@@ -111,6 +114,7 @@ TEST(HashedWString, Correctness) {
 }
 
 TEST(HashedWString, Constexprness) {
+    using namespace entt::literals;
     constexpr std::wstring_view view{L"foobar__", 6};
 
     static_assert(entt::hashed_wstring{L"quux"} == L"quux"_hws);

+ 2 - 0
test/entt/core/monostate.cpp

@@ -3,6 +3,8 @@
 #include <entt/core/monostate.hpp>
 
 TEST(Monostate, Functionalities) {
+    using namespace entt::literals;
+
     const bool b_pre = entt::monostate<entt::hashed_string{"foobar"}>{};
     const int i_pre = entt::monostate<"foobar"_hs>{};
 

+ 2 - 1
test/entt/core/type_traits.cpp

@@ -27,7 +27,7 @@ TEST(TypeTraits, UnpackAsValue) {
 }
 
 TEST(TypeTraits, IntegralConstant) {
-    entt::integral_constant<3> constant;
+    entt::integral_constant<3> constant{};
 
     static_assert(std::is_same_v<typename entt::integral_constant<3>::value_type, int>);
     static_assert(constant.value == 3);
@@ -90,6 +90,7 @@ TEST(TypeTraits, MemberClass) {
 }
 
 TEST(TypeTraits, Tag) {
+    using namespace entt::literals;
     static_assert(entt::tag<"foobar"_hs>::value == entt::hashed_string::value("foobar"));
     static_assert(std::is_same_v<typename entt::tag<"foobar"_hs>::value_type, entt::id_type>);
 }

+ 9 - 3
test/entt/meta/meta_any.cpp

@@ -51,6 +51,8 @@ struct unmanageable_t {
 
 struct MetaAny: ::testing::Test {
     static void SetUpTestCase() {
+        using namespace entt::literals;
+
         entt::meta<double>().conv<int>();
         entt::meta<empty_t>().dtor<&empty_t::destroy>();
         entt::meta<fat_t>().base<empty_t>().dtor<&fat_t::destroy>();
@@ -430,7 +432,7 @@ TEST_F(MetaAny, SBOSwap) {
 }
 
 TEST_F(MetaAny, NoSBOSwap) {
-    int i, j;
+    int i{}, j{};
     entt::meta_any lhs{fat_t{&i}};
     entt::meta_any rhs{fat_t{&j}};
 
@@ -490,7 +492,7 @@ TEST_F(MetaAny, SBOWithVoidSwap) {
 }
 
 TEST_F(MetaAny, NoSBOWithEmptySwap) {
-    int i;
+    int i{};
     entt::meta_any lhs{fat_t{&i}};
     entt::meta_any rhs{};
 
@@ -504,7 +506,7 @@ TEST_F(MetaAny, NoSBOWithEmptySwap) {
 }
 
 TEST_F(MetaAny, NoSBOWithVoidSwap) {
-    int i;
+    int i{};
     entt::meta_any lhs{fat_t{&i}};
     entt::meta_any rhs{std::in_place_type<void>};
 
@@ -638,6 +640,8 @@ TEST_F(MetaAny, UnmanageableType) {
 }
 
 TEST_F(MetaAny, Invoke) {
+    using namespace entt::literals;
+
     clazz_t instance;
     entt::meta_any any{std::ref(instance)};
 
@@ -650,6 +654,8 @@ TEST_F(MetaAny, Invoke) {
 }
 
 TEST_F(MetaAny, SetGet) {
+    using namespace entt::literals;
+
     clazz_t instance;
     entt::meta_any any{std::ref(instance)};
 

+ 4 - 0
test/entt/meta/meta_base.cpp

@@ -9,12 +9,16 @@ struct derived_t: base_t {};
 
 struct MetaBase: ::testing::Test {
     static void SetUpTestCase() {
+        using namespace entt::literals;
+
         entt::meta<base_t>().type("base"_hs);
         entt::meta<derived_t>().type("derived"_hs).base<base_t>();
     }
 };
 
 TEST_F(MetaBase, Functionalities) {
+    using namespace entt::literals;
+
     auto base = entt::resolve<derived_t>().base("base"_hs);
     derived_t derived{};
 

+ 8 - 0
test/entt/meta/meta_ctor.cpp

@@ -32,6 +32,8 @@ struct clazz_t {
 
 struct MetaCtor: ::testing::Test {
     static void SetUpTestCase() {
+        using namespace entt::literals;
+
         entt::meta<double>().conv<int>();
         entt::meta<derived_t>().base<base_t>();
 
@@ -45,6 +47,8 @@ struct MetaCtor: ::testing::Test {
 };
 
 TEST_F(MetaCtor, Functionalities) {
+    using namespace entt::literals;
+
     auto ctor = entt::resolve<clazz_t>().ctor<const int &, char>();
 
     ASSERT_TRUE(ctor);
@@ -78,6 +82,8 @@ TEST_F(MetaCtor, Functionalities) {
 }
 
 TEST_F(MetaCtor, Func) {
+    using namespace entt::literals;
+
     auto ctor = entt::resolve<clazz_t>().ctor<int>();
 
     ASSERT_TRUE(ctor);
@@ -152,6 +158,8 @@ TEST_F(MetaCtor, FuncCastAndConvert) {
 }
 
 TEST_F(MetaCtor, ExternalMemberFunction) {
+    using namespace entt::literals;
+
     auto ctor = entt::resolve<clazz_t>().ctor<entt::registry &, entt::entity, const int &, const char &>();
 
     ASSERT_TRUE(ctor);

+ 45 - 1
test/entt/meta/meta_data.cpp

@@ -64,6 +64,8 @@ enum class property_t {
 
 struct MetaData: ::testing::Test {
     static void SetUpTestCase() {
+        using namespace entt::literals;
+
         entt::meta<double>().conv<int>();
         entt::meta<base_t>().dtor<&base_t::destroy>().data<&base_t::value>("value"_hs);
         entt::meta<derived_t>().base<base_t>().dtor<&derived_t::destroy>();
@@ -97,6 +99,8 @@ struct MetaData: ::testing::Test {
 };
 
 TEST_F(MetaData, Functionalities) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<clazz_t>().data("i"_hs);
     clazz_t instance{};
 
@@ -126,6 +130,8 @@ TEST_F(MetaData, Functionalities) {
 }
 
 TEST_F(MetaData, Const) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<clazz_t>().data("j"_hs);
     clazz_t instance{};
 
@@ -155,6 +161,8 @@ TEST_F(MetaData, Const) {
 }
 
 TEST_F(MetaData, Static) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<clazz_t>().data("h"_hs);
 
     ASSERT_TRUE(data);
@@ -183,6 +191,8 @@ TEST_F(MetaData, Static) {
 }
 
 TEST_F(MetaData, ConstStatic) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<clazz_t>().data("k"_hs);
 
     ASSERT_TRUE(data);
@@ -211,6 +221,8 @@ TEST_F(MetaData, ConstStatic) {
 }
 
 TEST_F(MetaData, GetMetaAnyArg) {
+    using namespace entt::literals;
+
     entt::meta_any any{clazz_t{}};
     any.cast<clazz_t>().i = 99;
     const auto value = entt::resolve<clazz_t>().data("i"_hs).get(any);
@@ -221,11 +233,15 @@ TEST_F(MetaData, GetMetaAnyArg) {
 }
 
 TEST_F(MetaData, GetInvalidArg) {
+    using namespace entt::literals;
+
     auto instance = 0;
     ASSERT_FALSE(entt::resolve<clazz_t>().data("i"_hs).get(instance));
 }
 
 TEST_F(MetaData, SetMetaAnyArg) {
+    using namespace entt::literals;
+
     entt::meta_any any{clazz_t{}};
     entt::meta_any value{42};
 
@@ -235,10 +251,14 @@ TEST_F(MetaData, SetMetaAnyArg) {
 }
 
 TEST_F(MetaData, SetInvalidArg) {
+    using namespace entt::literals;
+
     ASSERT_FALSE(entt::resolve<clazz_t>().data("i"_hs).set({}, 'c'));
 }
 
 TEST_F(MetaData, SetCast) {
+    using namespace entt::literals;
+
     clazz_t instance{};
 
     ASSERT_EQ(base_t::counter, 0);
@@ -247,6 +267,8 @@ TEST_F(MetaData, SetCast) {
 }
 
 TEST_F(MetaData, SetConvert) {
+    using namespace entt::literals;
+
     clazz_t instance{};
 
     ASSERT_EQ(instance.i, 0);
@@ -255,6 +277,8 @@ TEST_F(MetaData, SetConvert) {
 }
 
 TEST_F(MetaData, SetterGetterAsFreeFunctions) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<setter_getter_t>().data("x"_hs);
     setter_getter_t instance{};
 
@@ -270,6 +294,8 @@ TEST_F(MetaData, SetterGetterAsFreeFunctions) {
 }
 
 TEST_F(MetaData, SetterGetterAsMemberFunctions) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<setter_getter_t>().data("y"_hs);
     setter_getter_t instance{};
 
@@ -285,6 +311,8 @@ TEST_F(MetaData, SetterGetterAsMemberFunctions) {
 }
 
 TEST_F(MetaData, SetterGetterWithRefAsMemberFunctions) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<setter_getter_t>().data("w"_hs);
     setter_getter_t instance{};
 
@@ -300,6 +328,8 @@ TEST_F(MetaData, SetterGetterWithRefAsMemberFunctions) {
 }
 
 TEST_F(MetaData, SetterGetterMixed) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<setter_getter_t>().data("z"_hs);
     setter_getter_t instance{};
 
@@ -315,6 +345,8 @@ TEST_F(MetaData, SetterGetterMixed) {
 }
 
 TEST_F(MetaData, SetterGetterReadOnly) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<setter_getter_t>().data("z_ro"_hs);
     setter_getter_t instance{};
 
@@ -330,6 +362,8 @@ TEST_F(MetaData, SetterGetterReadOnly) {
 }
 
 TEST_F(MetaData, SetterGetterReadOnlyDataMember) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<setter_getter_t>().data("value"_hs);
     setter_getter_t instance{};
 
@@ -345,6 +379,8 @@ TEST_F(MetaData, SetterGetterReadOnlyDataMember) {
 }
 
 TEST_F(MetaData, ArrayStatic) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<array_t>().data("global"_hs);
 
     ASSERT_TRUE(data);
@@ -359,8 +395,10 @@ TEST_F(MetaData, ArrayStatic) {
 }
 
 TEST_F(MetaData, Array) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<array_t>().data("local"_hs);
-    array_t instance;
+    array_t instance{};
 
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("array"_hs));
@@ -374,6 +412,8 @@ TEST_F(MetaData, Array) {
 }
 
 TEST_F(MetaData, AsVoid) {
+    using namespace entt::literals;
+
     auto data = entt::resolve<clazz_t>().data("void"_hs);
     clazz_t instance{};
 
@@ -383,6 +423,8 @@ TEST_F(MetaData, AsVoid) {
 }
 
 TEST_F(MetaData, AsRef) {
+    using namespace entt::literals;
+
     clazz_t instance{};
 
     auto h_data = entt::resolve<clazz_t>().data("h"_hs);
@@ -399,6 +441,8 @@ TEST_F(MetaData, AsRef) {
 }
 
 TEST_F(MetaData, FromBase) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<derived_t>();
     derived_t instance;
 

+ 28 - 0
test/entt/meta/meta_func.cpp

@@ -61,6 +61,8 @@ struct func_t {
 
 struct MetaFunc: ::testing::Test {
     static void SetUpTestCase() {
+        using namespace entt::literals;
+
         entt::meta<double>().conv<int>();
         entt::meta<base_t>().dtor<&base_t::destroy>().func<&base_t::func>("func"_hs);
         entt::meta<derived_t>().base<base_t>().dtor<&derived_t::destroy>();
@@ -83,6 +85,8 @@ struct MetaFunc: ::testing::Test {
 };
 
 TEST_F(MetaFunc, Functionalities) {
+    using namespace entt::literals;
+
     auto func = entt::resolve<func_t>().func("f2"_hs);
     func_t instance{};
 
@@ -122,6 +126,8 @@ TEST_F(MetaFunc, Functionalities) {
 }
 
 TEST_F(MetaFunc, Const) {
+    using namespace entt::literals;
+
     auto func = entt::resolve<func_t>().func("f1"_hs);
     func_t instance{};
 
@@ -159,6 +165,8 @@ TEST_F(MetaFunc, Const) {
 }
 
 TEST_F(MetaFunc, RetVoid) {
+    using namespace entt::literals;
+
     auto func = entt::resolve<func_t>().func("g"_hs);
     func_t instance{};
 
@@ -194,6 +202,8 @@ TEST_F(MetaFunc, RetVoid) {
 }
 
 TEST_F(MetaFunc, Static) {
+    using namespace entt::literals;
+
     auto func = entt::resolve<func_t>().func("h"_hs);
     func_t::value = 2;
 
@@ -231,6 +241,8 @@ TEST_F(MetaFunc, Static) {
 }
 
 TEST_F(MetaFunc, StaticRetVoid) {
+    using namespace entt::literals;
+
     auto func = entt::resolve<func_t>().func("k"_hs);
 
     ASSERT_TRUE(func);
@@ -266,6 +278,8 @@ TEST_F(MetaFunc, StaticRetVoid) {
 }
 
 TEST_F(MetaFunc, MetaAnyArgs) {
+    using namespace entt::literals;
+
     func_t instance;
     auto any = entt::resolve<func_t>().func("f1"_hs).invoke(instance, 3);
 
@@ -275,11 +289,15 @@ TEST_F(MetaFunc, MetaAnyArgs) {
 }
 
 TEST_F(MetaFunc, InvalidArgs) {
+    using namespace entt::literals;
+
     int value = 3;
     ASSERT_FALSE(entt::resolve<func_t>().func("f1"_hs).invoke(value, 'c'));
 }
 
 TEST_F(MetaFunc, CastAndConvert) {
+    using namespace entt::literals;
+
     func_t instance;
     auto any = entt::resolve<func_t>().func("f3"_hs).invoke(instance, derived_t{}, 0, 3.);
 
@@ -289,6 +307,8 @@ TEST_F(MetaFunc, CastAndConvert) {
 }
 
 TEST_F(MetaFunc, AsVoid) {
+    using namespace entt::literals;
+
     auto func = entt::resolve<func_t>().func("v"_hs);
     func_t instance{};
 
@@ -298,6 +318,8 @@ TEST_F(MetaFunc, AsVoid) {
 }
 
 TEST_F(MetaFunc, AsRef) {
+    using namespace entt::literals;
+
     func_t instance{};
     auto func = entt::resolve<func_t>().func("a"_hs);
     func.invoke(instance).cast<int>() = 3;
@@ -307,6 +329,8 @@ TEST_F(MetaFunc, AsRef) {
 }
 
 TEST_F(MetaFunc, ByReference) {
+    using namespace entt::literals;
+
     auto func = entt::resolve<func_t>().func("h"_hs);
     func_t::value = 2;
     entt::meta_any any{3};
@@ -319,6 +343,8 @@ TEST_F(MetaFunc, ByReference) {
 }
 
 TEST_F(MetaFunc, FromBase) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<derived_t>();
     derived_t instance;
 
@@ -332,6 +358,8 @@ TEST_F(MetaFunc, FromBase) {
 }
 
 TEST_F(MetaFunc, ExternalMemberFunction) {
+    using namespace entt::literals;
+
     auto func = entt::resolve<func_t>().func("emplace"_hs);
 
     ASSERT_TRUE(func);

+ 6 - 0
test/entt/meta/meta_prop.cpp

@@ -10,6 +10,8 @@ struct derived_t: base_1_t, base_2_t {};
 
 struct MetaProp: ::testing::Test {
     static void SetUpTestCase() {
+        using namespace entt::literals;
+
         entt::meta<base_1_t>().prop("int"_hs, 42);
         entt::meta<base_2_t>().prop("bool"_hs, false);
         entt::meta<derived_t>().base<base_1_t>().base<base_2_t>();
@@ -17,6 +19,8 @@ struct MetaProp: ::testing::Test {
 };
 
 TEST_F(MetaProp, Functionalities) {
+    using namespace entt::literals;
+
     auto prop = entt::resolve<base_1_t>().prop("int"_hs);
 
     ASSERT_TRUE(prop);
@@ -25,6 +29,8 @@ TEST_F(MetaProp, Functionalities) {
 }
 
 TEST_F(MetaProp, FromBase) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<derived_t>();
     auto prop_bool = type.prop("bool"_hs);
     auto prop_int = type.prop("int"_hs);

+ 4 - 0
test/entt/meta/meta_range.cpp

@@ -7,12 +7,16 @@
 
 struct MetaRange: ::testing::Test {
     static void SetUpTestCase() {
+        using namespace entt::literals;
+
         entt::meta<int>().type("int"_hs);
         entt::meta<double>().type("double"_hs);
     }
 };
 
 TEST_F(MetaRange, Range) {
+    using namespace entt::literals;
+
     entt::meta_range<entt::meta_type> range{entt::internal::meta_context::local()};
     auto it = range.begin();
 

+ 32 - 0
test/entt/meta/meta_type.cpp

@@ -92,6 +92,8 @@ union union_t {
 
 struct MetaType: ::testing::Test {
     static void SetUpTestCase() {
+        using namespace entt::literals;
+
         entt::meta<double>().type("double"_hs).conv<int>().data<&set<double>, &get<double>>("var"_hs);
         entt::meta<unsigned int>().data<0u>("min"_hs).data<100u>("max"_hs);
         entt::meta<base_t>().type("base"_hs).data<&base_t::value>("value"_hs);
@@ -131,6 +133,8 @@ struct MetaType: ::testing::Test {
 };
 
 TEST_F(MetaType, Resolve) {
+    using namespace entt::literals;
+
     ASSERT_EQ(entt::resolve<double>(), entt::resolve("double"_hs));
     ASSERT_EQ(entt::resolve<double>(), entt::resolve(entt::type_id<double>()));
 
@@ -151,6 +155,8 @@ TEST_F(MetaType, Resolve) {
 }
 
 TEST_F(MetaType, Functionalities) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<clazz_t>();
 
     ASSERT_TRUE(type);
@@ -246,6 +252,8 @@ TEST_F(MetaType, RemoveExtent) {
 }
 
 TEST_F(MetaType, Base) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<derived_t>();
     bool iterate = false;
 
@@ -290,6 +298,8 @@ TEST_F(MetaType, Ctor) {
 }
 
 TEST_F(MetaType, Data) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<clazz_t>();
     int counter{};
 
@@ -302,6 +312,8 @@ TEST_F(MetaType, Data) {
 }
 
 TEST_F(MetaType, Func) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<clazz_t>();
     clazz_t instance{};
     int counter{};
@@ -318,6 +330,8 @@ TEST_F(MetaType, Func) {
 }
 
 TEST_F(MetaType, Invoke) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<clazz_t>();
     clazz_t instance{};
 
@@ -326,6 +340,8 @@ TEST_F(MetaType, Invoke) {
 }
 
 TEST_F(MetaType, OverloadedFunc) {
+    using namespace entt::literals;
+
     entt::meta<float>().conv<int>();
     entt::meta<double>().conv<float>();
 
@@ -377,6 +393,8 @@ TEST_F(MetaType, OverloadedFunc) {
 }
 
 TEST_F(MetaType, SetGet) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<clazz_t>();
     clazz_t instance{};
 
@@ -426,6 +444,8 @@ TEST_F(MetaType, ConstructCastAndConvert) {
 }
 
 TEST_F(MetaType, Reset) {
+    using namespace entt::literals;
+
     ASSERT_TRUE(entt::resolve("clazz"_hs));
 
     entt::resolve("clazz"_hs).reset();
@@ -441,6 +461,8 @@ TEST_F(MetaType, Reset) {
 }
 
 TEST_F(MetaType, AbstractClass) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<abstract_t>();
     concrete_t instance;
 
@@ -455,6 +477,8 @@ TEST_F(MetaType, AbstractClass) {
 }
 
 TEST_F(MetaType, EnumAndNamedConstants) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<property_t>();
 
     ASSERT_TRUE(type.data("random"_hs));
@@ -471,6 +495,8 @@ TEST_F(MetaType, EnumAndNamedConstants) {
 }
 
 TEST_F(MetaType, ArithmeticTypeAndNamedConstants) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<unsigned int>();
 
     ASSERT_TRUE(type.data("min"_hs));
@@ -487,6 +513,8 @@ TEST_F(MetaType, ArithmeticTypeAndNamedConstants) {
 }
 
 TEST_F(MetaType, Variables) {
+    using namespace entt::literals;
+
     auto p_data = entt::resolve<property_t>().data("var"_hs);
     auto d_data = entt::resolve("double"_hs).data("var"_hs);
 
@@ -503,6 +531,8 @@ TEST_F(MetaType, Variables) {
 }
 
 TEST_F(MetaType, PropertiesAndCornerCases) {
+    using namespace entt::literals;
+
     auto type = entt::resolve<property_t>();
 
     ASSERT_EQ(type.data("random"_hs).prop(property_t::random).value().cast<int>(), 0);
@@ -523,6 +553,8 @@ TEST_F(MetaType, PropertiesAndCornerCases) {
 }
 
 TEST_F(MetaType, ResetAndReRegistrationAfterReset) {
+    using namespace entt::literals;
+
     ASSERT_NE(*entt::internal::meta_context::global(), nullptr);
 
     entt::resolve<double>().reset();

+ 2 - 0
test/entt/resource/resource.cpp

@@ -110,6 +110,8 @@ TEST(Resource, MutableHandle) {
 }
 
 TEST(Resource, Each) {
+    using namespace entt::literals;
+
     entt::resource_cache<resource> cache;
     cache.load<loader>("resource"_hs, 0);
 

+ 2 - 0
test/lib/meta/lib.cpp

@@ -10,6 +10,8 @@ position create_position(int x, int y) {
 }
 
 ENTT_API void set_up() {
+    using namespace entt::literals;
+
     entt::meta<position>()
             .type("position"_hs)
             .ctor<&create_position>()

+ 2 - 0
test/lib/meta/main.cpp

@@ -10,6 +10,8 @@ ENTT_API void tear_down();
 ENTT_API entt::meta_any wrap_int(int);
 
 TEST(Lib, Meta) {
+    using namespace entt::literals;
+
     ASSERT_FALSE(entt::resolve("position"_hs));
     ASSERT_FALSE(entt::resolve("velocity"_hs));
 

+ 2 - 0
test/lib/meta_plugin/main.cpp

@@ -8,6 +8,8 @@
 #include "types.h"
 
 TEST(Lib, Meta) {
+    using namespace entt::literals;
+
     ASSERT_FALSE(entt::resolve("position"_hs));
 
     userdata ud{};

+ 2 - 0
test/lib/meta_plugin/plugin.cpp

@@ -10,6 +10,8 @@ position create_position(int x, int y) {
 }
 
 void set_up() {
+    using namespace entt::literals;
+
     entt::meta<position>()
             .type("position"_hs)
             .ctor<&create_position>()

+ 2 - 0
test/lib/meta_plugin_std/main.cpp

@@ -8,6 +8,8 @@
 #include "types.h"
 
 TEST(Lib, Meta) {
+    using namespace entt::literals;
+
     ASSERT_FALSE(entt::resolve("position"_hs));
 
     userdata ud{};

+ 2 - 0
test/lib/meta_plugin_std/plugin.cpp

@@ -10,6 +10,8 @@ position create_position(int x, int y) {
 }
 
 void set_up() {
+    using namespace entt::literals;
+
     entt::meta<position>()
             .type("position"_hs)
             .ctor<&create_position>()

+ 4 - 0
test/snapshot/snapshot.cpp

@@ -36,6 +36,8 @@ void serialize(Archive &archive, relationship &relationship) {
 }
 
 TEST(Snapshot, Full) {
+    using namespace entt::literals;
+
     std::stringstream storage;
 
     entt::registry source;
@@ -91,6 +93,8 @@ TEST(Snapshot, Full) {
 }
 
 TEST(Snapshot, Continuous) {
+    using namespace entt::literals;
+
     std::stringstream storage;
 
     entt::registry source;