meta: minor changes

This commit is contained in:
Michele Caini
2020-06-23 11:30:53 +02:00
parent 5d42a76fe5
commit 450e20ae78
4 changed files with 18 additions and 20 deletions

View File

@@ -345,11 +345,11 @@ public:
: node{head}
{}
iterator begin() const ENTT_NOEXCEPT {
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
return iterator{node};
}
iterator end() const ENTT_NOEXCEPT {
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
return iterator{};
}

View File

@@ -127,17 +127,15 @@ class meta_any {
template<typename Type>
[[nodiscard]] static meta_any dereference_operator(meta_any &any) {
meta_any other{};
if constexpr(is_meta_pointer_like_v<Type>) {
if constexpr(std::is_const_v<std::remove_reference_t<decltype(*std::declval<Type>())>>) {
other = *any.cast<Type>();
return *any.cast<Type>();
} else {
other = std::ref(*any.cast<Type>());
return std::ref(*any.cast<Type>());
}
} else {
return {};
}
return other;
}
template<typename Type>
@@ -676,7 +674,7 @@ struct meta_ctor {
* @brief Returns a range to use to visit all meta properties.
* @return An iterable range to use to visit all meta properties.
*/
meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
return node->prop;
}
@@ -787,7 +785,7 @@ struct meta_data {
}
/*! @copydoc meta_ctor::prop */
meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
return node->prop;
}
@@ -913,7 +911,7 @@ struct meta_func {
}
/*! @copydoc meta_ctor::prop */
meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
return node->prop;
}
@@ -1159,7 +1157,7 @@ public:
* @brief Returns a range to use to visit top-level meta bases.
* @return An iterable range to use to visit top-level meta bases.
*/
meta_range<meta_base> base() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_base> base() const ENTT_NOEXCEPT {
return node->base;
}
@@ -1194,7 +1192,7 @@ public:
* @return An iterable range to use to visit top-level meta conversion
* functions.
*/
meta_range<meta_conv> conv() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_conv> conv() const ENTT_NOEXCEPT {
return node->conv;
}
@@ -1228,7 +1226,7 @@ public:
* @brief Returns a range to use to visit top-level meta constructors.
* @return An iterable range to use to visit top-level meta constructors.
*/
meta_range<meta_ctor> ctor() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_ctor> ctor() const ENTT_NOEXCEPT {
return node->ctor;
}
@@ -1259,7 +1257,7 @@ public:
* @brief Returns a range to use to visit top-level meta data.
* @return An iterable range to use to visit top-level meta data.
*/
meta_range<meta_data> data() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_data> data() const ENTT_NOEXCEPT {
return node->data;
}
@@ -1295,7 +1293,7 @@ public:
* @brief Returns a range to use to visit top-level meta functions.
* @return An iterable range to use to visit top-level meta functions.
*/
meta_range<meta_func> func() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_func> func() const ENTT_NOEXCEPT {
return node->func;
}
@@ -1358,7 +1356,7 @@ public:
* @brief Returns a range to use to visit top-level meta properties.
* @return An iterable range to use to visit top-level meta properties.
*/
meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
return node->prop;
}

View File

@@ -74,7 +74,7 @@ public:
* @brief Returns an iterator to the beginning.
* @return An iterator to the first meta object of the range.
*/
iterator begin() const ENTT_NOEXCEPT {
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
return iterator{node};
}
@@ -83,7 +83,7 @@ public:
* @return An iterator to the element following the last meta object of the
* range.
*/
iterator end() const ENTT_NOEXCEPT {
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
return iterator{};
}

View File

@@ -26,7 +26,7 @@ template<typename Type>
* @brief Returns a range to use to visit all meta types.
* @return An iterable range to use to visit all meta types.
*/
inline meta_range<meta_type> resolve() {
[[nodiscard]] inline meta_range<meta_type> resolve() {
return *internal::meta_context::global();
}