From f185494de37a8d3c6700064d3cfa8db57e72cf29 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sun, 5 Apr 2020 22:03:52 +0200 Subject: [PATCH] type info: added has_type_index[_v] --- src/entt/core/type_info.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/entt/core/type_info.hpp b/src/entt/core/type_info.hpp index 80ad0ec17..5b68871de 100644 --- a/src/entt/core/type_info.hpp +++ b/src/entt/core/type_info.hpp @@ -54,6 +54,28 @@ struct ENTT_API type_index { }; +/** + * @brief Provides the member constant `value` to true if a given type is + * indexable, false otherwise. + * @tparam Type Potentially indexable type. + */ +template +struct has_type_index: std::false_type {}; + + +/*! @brief has_type_index */ +template +struct has_type_index::value())>>: std::true_type {}; + + +/** + * @brief Helper variable template. + * @tparam Type Potentially indexable type. + */ +template +inline constexpr bool has_type_index_v = has_type_index::value; + + /** * @brief Type info. * @tparam Type Type for which to generate information.