[[nodiscard]]: try to get around an issue with VS2017 (see #501)

This commit is contained in:
Michele Caini
2020-06-07 12:55:02 +02:00
parent 2cafb49ffe
commit 171463faf5
3 changed files with 15 additions and 7 deletions

View File

@@ -38,7 +38,7 @@ struct monostate {
* @return Stored value, if any.
*/
template<typename Type>
[[nodiscard]] operator Type() const ENTT_NOEXCEPT {
operator Type() const ENTT_NOEXCEPT {
return value<Type>;
}

View File

@@ -36,7 +36,7 @@ struct as_view {
* @return A newly created view.
*/
template<typename Exclude, typename... Component>
[[nodiscard]] operator entt::basic_view<Entity, Exclude, Component...>() const {
operator entt::basic_view<Entity, Exclude, Component...>() const {
return reg.template view<Component...>(Exclude{});
}
@@ -86,7 +86,7 @@ struct as_group {
* @return A newly created group.
*/
template<typename Exclude, typename Get, typename... Owned>
[[nodiscard]] operator entt::basic_group<Entity, Exclude, Get, Owned...>() const {
operator entt::basic_group<Entity, Exclude, Get, Owned...>() const {
return reg.template group<Owned...>(Get{}, Exclude{});
}

View File

@@ -57,16 +57,24 @@ public:
}
/*! @copydoc get */
[[nodiscard]] operator const Resource & () const ENTT_NOEXCEPT { return get(); }
[[nodiscard]] operator const Resource & () const ENTT_NOEXCEPT {
return get();
}
/*! @copydoc get */
[[nodiscard]] operator Resource & () ENTT_NOEXCEPT { return get(); }
[[nodiscard]] operator Resource & () ENTT_NOEXCEPT {
return get();
}
/*! @copydoc get */
[[nodiscard]] const Resource & operator *() const ENTT_NOEXCEPT { return get(); }
[[nodiscard]] const Resource & operator *() const ENTT_NOEXCEPT {
return get();
}
/*! @copydoc get */
[[nodiscard]] Resource & operator *() ENTT_NOEXCEPT { return get(); }
[[nodiscard]] Resource & operator *() ENTT_NOEXCEPT {
return get();
}
/**
* @brief Gets a pointer to the managed resource.