meta: prepare to remove ENTT_NOEXCEPT[_IF]

This commit is contained in:
Michele Caini
2022-05-06 08:23:52 +02:00
parent 942879bbba
commit b176be9ef7
8 changed files with 177 additions and 180 deletions

View File

@@ -39,7 +39,7 @@ struct basic_meta_sequence_container_traits {
using iterator = meta_sequence_container::iterator;
using size_type = std::size_t;
[[nodiscard]] static size_type size(const any &container) ENTT_NOEXCEPT {
[[nodiscard]] static size_type size(const any &container) noexcept {
return any_cast<const Type &>(container).size();
}
@@ -97,7 +97,7 @@ struct basic_meta_associative_container_traits {
static constexpr auto key_only = is_key_only_meta_associative_container<Type>::value;
[[nodiscard]] static size_type size(const any &container) ENTT_NOEXCEPT {
[[nodiscard]] static size_type size(const any &container) noexcept {
return any_cast<const Type &>(container).size();
}

View File

@@ -1,7 +1,6 @@
#ifndef ENTT_META_CTX_HPP
#define ENTT_META_CTX_HPP
#include "../config/config.h"
#include "../core/attribute.h"
namespace entt {
@@ -20,12 +19,12 @@ struct ENTT_API meta_context {
// inline static meta_type_node *local = nullptr;
// inline static meta_type_node **global = &local;
[[nodiscard]] static meta_type_node *&local() ENTT_NOEXCEPT {
[[nodiscard]] static meta_type_node *&local() noexcept {
static meta_type_node *chain = nullptr;
return chain;
}
[[nodiscard]] static meta_type_node **&global() ENTT_NOEXCEPT {
[[nodiscard]] static meta_type_node **&global() noexcept {
static meta_type_node **chain = &local();
return chain;
}
@@ -44,7 +43,7 @@ struct meta_ctx {
* @brief Binds the meta system to a given context.
* @param other A valid context to which to bind.
*/
static void bind(meta_ctx other) ENTT_NOEXCEPT {
static void bind(meta_ctx other) noexcept {
internal::meta_context::global() = other.ctx;
}

View File

@@ -26,7 +26,7 @@ namespace entt {
namespace internal {
inline void link_prop_if_required(internal::meta_prop_node **ref, internal::meta_prop_node &node) ENTT_NOEXCEPT {
inline void link_prop_if_required(internal::meta_prop_node **ref, internal::meta_prop_node &node) noexcept {
if(meta_range<internal::meta_prop_node *, internal::meta_prop_node> range{*ref}; std::find(range.cbegin(), range.cend(), &node) == range.cend()) {
ENTT_ASSERT(std::find_if(range.cbegin(), range.cend(), [&node](const auto *curr) { return curr->id == node.id; }) == range.cend(), "Duplicate identifier");
node.next = *ref;
@@ -34,7 +34,7 @@ inline void link_prop_if_required(internal::meta_prop_node **ref, internal::meta
}
}
inline void link_type_if_required(meta_type_node *owner, const id_type id) ENTT_NOEXCEPT {
inline void link_type_if_required(meta_type_node *owner, const id_type id) noexcept {
meta_range<meta_type_node *, meta_type_node> range{*meta_context::global()};
ENTT_ASSERT(std::find_if(range.cbegin(), range.cend(), [&](const auto *curr) { return curr != owner && curr->id == id; }) == range.cend(), "Duplicate identifier");
owner->id = id;
@@ -45,28 +45,28 @@ inline void link_type_if_required(meta_type_node *owner, const id_type id) ENTT_
}
}
inline void link_base_if_required(meta_type_node *owner, meta_base_node &node) ENTT_NOEXCEPT {
inline void link_base_if_required(meta_type_node *owner, meta_base_node &node) noexcept {
if(meta_range<meta_base_node *, meta_base_node> range{owner->base}; std::find(range.cbegin(), range.cend(), &node) == range.cend()) {
node.next = owner->base;
owner->base = &node;
}
}
inline void link_conv_if_required(meta_type_node *owner, meta_conv_node &node) ENTT_NOEXCEPT {
inline void link_conv_if_required(meta_type_node *owner, meta_conv_node &node) noexcept {
if(meta_range<meta_conv_node *, meta_conv_node> range{owner->conv}; std::find(range.cbegin(), range.cend(), &node) == range.cend()) {
node.next = owner->conv;
owner->conv = &node;
}
}
inline void link_ctor_if_required(meta_type_node *owner, meta_ctor_node &node) ENTT_NOEXCEPT {
inline void link_ctor_if_required(meta_type_node *owner, meta_ctor_node &node) noexcept {
if(meta_range<meta_ctor_node *, meta_ctor_node> range{owner->ctor}; std::find(range.cbegin(), range.cend(), &node) == range.cend()) {
node.next = owner->ctor;
owner->ctor = &node;
}
}
inline void link_data_if_required(meta_type_node *owner, const id_type id, meta_data_node &node) ENTT_NOEXCEPT {
inline void link_data_if_required(meta_type_node *owner, const id_type id, meta_data_node &node) noexcept {
meta_range<meta_data_node *, meta_data_node> range{owner->data};
ENTT_ASSERT(std::find_if(range.cbegin(), range.cend(), [id, &node](const auto *curr) { return curr != &node && curr->id == id; }) == range.cend(), "Duplicate identifier");
node.id = id;
@@ -77,7 +77,7 @@ inline void link_data_if_required(meta_type_node *owner, const id_type id, meta_
}
}
inline void link_func_if_required(meta_type_node *owner, const id_type id, meta_func_node &node) ENTT_NOEXCEPT {
inline void link_func_if_required(meta_type_node *owner, const id_type id, meta_func_node &node) noexcept {
node.id = id;
if(meta_range<meta_func_node *, meta_func_node> range{owner->func}; std::find(range.cbegin(), range.cend(), &node) == range.cend()) {
@@ -112,25 +112,25 @@ class meta_factory;
template<typename Type, typename... Spec>
class meta_factory<Type, Spec...>: public meta_factory<Type> {
template<std::size_t Step = 0, typename... Property, typename... Other>
void unroll(choice_t<2>, std::tuple<Property...> property, Other &&...other) ENTT_NOEXCEPT {
void unroll(choice_t<2>, std::tuple<Property...> property, Other &&...other) noexcept {
std::apply([this](auto &&...curr) { (this->unroll<Step>(choice<2>, std::forward<Property>(curr)...)); }, property);
unroll<Step + sizeof...(Property)>(choice<2>, std::forward<Other>(other)...);
}
template<std::size_t Step = 0, typename... Property, typename... Other>
void unroll(choice_t<1>, std::pair<Property...> property, Other &&...other) ENTT_NOEXCEPT {
void unroll(choice_t<1>, std::pair<Property...> property, Other &&...other) noexcept {
assign<Step>(std::move(property.first), std::move(property.second));
unroll<Step + 1>(choice<2>, std::forward<Other>(other)...);
}
template<std::size_t Step = 0, typename Property, typename... Other>
void unroll(choice_t<0>, Property &&property, Other &&...other) ENTT_NOEXCEPT {
void unroll(choice_t<0>, Property &&property, Other &&...other) noexcept {
assign<Step>(std::forward<Property>(property));
unroll<Step + 1>(choice<2>, std::forward<Other>(other)...);
}
template<std::size_t>
void unroll(choice_t<0>) ENTT_NOEXCEPT {}
void unroll(choice_t<0>) noexcept {}
template<std::size_t = 0>
void assign(meta_any key, meta_any value = {}) {
@@ -154,7 +154,7 @@ public:
* @brief Constructs an extended factory from a given node.
* @param target The underlying node to which to assign the properties.
*/
meta_factory(internal::meta_prop_node **target) ENTT_NOEXCEPT
meta_factory(internal::meta_prop_node **target) noexcept
: ref{target} {}
/**
@@ -205,7 +205,7 @@ private:
template<typename Type>
class meta_factory<Type> {
template<typename Setter, auto Getter, typename Policy, std::size_t... Index>
auto data(const id_type id, std::index_sequence<Index...>) ENTT_NOEXCEPT {
auto data(const id_type id, std::index_sequence<Index...>) noexcept {
using data_type = std::invoke_result_t<decltype(Getter), Type &>;
using args_type = type_list<typename meta_function_helper_t<Type, decltype(value_list_element_v<Index, Setter>)>::args_type...>;
static_assert(Policy::template value<data_type>, "Invalid return type for the given policy");
@@ -230,7 +230,7 @@ class meta_factory<Type> {
public:
/*! @brief Default constructor. */
meta_factory() ENTT_NOEXCEPT
meta_factory() noexcept
: owner{internal::meta_node<Type>::resolve()} {}
/**
@@ -238,7 +238,7 @@ public:
* @param id Optional unique identifier.
* @return An extended meta factory for the given type.
*/
auto type(const id_type id = type_hash<Type>::value()) ENTT_NOEXCEPT {
auto type(const id_type id = type_hash<Type>::value()) noexcept {
internal::link_type_if_required(owner, id);
return meta_factory<Type, Type>{&owner->prop};
}
@@ -252,13 +252,13 @@ public:
* @return A meta factory for the parent type.
*/
template<typename Base>
auto base() ENTT_NOEXCEPT {
auto base() noexcept {
static_assert(!std::is_same_v<Type, Base> && std::is_base_of_v<Base, Type>, "Invalid base type");
static internal::meta_base_node node{
nullptr,
internal::meta_node<Base>::resolve(),
[](meta_any other) ENTT_NOEXCEPT -> meta_any {
[](meta_any other) noexcept -> meta_any {
if(auto *ptr = other.data(); ptr) {
return forward_as_meta(*static_cast<Base *>(static_cast<Type *>(ptr)));
}
@@ -285,7 +285,7 @@ public:
* @return A meta factory for the parent type.
*/
template<auto Candidate>
auto conv() ENTT_NOEXCEPT {
auto conv() noexcept {
static internal::meta_conv_node node{
nullptr,
internal::meta_node<std::remove_cv_t<std::remove_reference_t<std::invoke_result_t<decltype(Candidate), Type &>>>>::resolve(),
@@ -309,7 +309,7 @@ public:
* @return A meta factory for the parent type.
*/
template<typename To>
auto conv() ENTT_NOEXCEPT {
auto conv() noexcept {
static internal::meta_conv_node node{
nullptr,
internal::meta_node<std::remove_cv_t<std::remove_reference_t<To>>>::resolve(),
@@ -335,7 +335,7 @@ public:
* @return An extended meta factory for the parent type.
*/
template<auto Candidate, typename Policy = as_is_t>
auto ctor() ENTT_NOEXCEPT {
auto ctor() noexcept {
using descriptor = meta_function_helper_t<Type, decltype(Candidate)>;
static_assert(Policy::template value<typename descriptor::return_type>, "Invalid return type for the given policy");
static_assert(std::is_same_v<std::remove_cv_t<std::remove_reference_t<typename descriptor::return_type>>, Type>, "The function doesn't return an object of the required type");
@@ -363,7 +363,7 @@ public:
* @return An extended meta factory for the parent type.
*/
template<typename... Args>
auto ctor() ENTT_NOEXCEPT {
auto ctor() noexcept {
using descriptor = meta_function_helper_t<Type, Type (*)(Args...)>;
static internal::meta_ctor_node node{
@@ -397,7 +397,7 @@ public:
* @return A meta factory for the parent type.
*/
template<auto Func>
auto dtor() ENTT_NOEXCEPT {
auto dtor() noexcept {
static_assert(std::is_invocable_v<decltype(Func), Type &>, "The function doesn't accept an object of the type provided");
owner->dtor = [](void *instance) { std::invoke(Func, *static_cast<Type *>(instance)); };
return meta_factory<Type>{};
@@ -417,7 +417,7 @@ public:
* @return An extended meta factory for the parent type.
*/
template<auto Data, typename Policy = as_is_t>
auto data(const id_type id) ENTT_NOEXCEPT {
auto data(const id_type id) noexcept {
if constexpr(std::is_member_object_pointer_v<decltype(Data)>) {
using data_type = std::remove_reference_t<std::invoke_result_t<decltype(Data), Type &>>;
@@ -479,7 +479,7 @@ public:
* @return An extended meta factory for the parent type.
*/
template<auto Setter, auto Getter, typename Policy = as_is_t>
auto data(const id_type id) ENTT_NOEXCEPT {
auto data(const id_type id) noexcept {
using data_type = std::invoke_result_t<decltype(Getter), Type &>;
static_assert(Policy::template value<data_type>, "Invalid return type for the given policy");
@@ -540,7 +540,7 @@ public:
* @return An extended meta factory for the parent type.
*/
template<typename Setter, auto Getter, typename Policy = as_is_t>
auto data(const id_type id) ENTT_NOEXCEPT {
auto data(const id_type id) noexcept {
return data<Setter, Getter, Policy>(id, std::make_index_sequence<Setter::size>{});
}
@@ -558,7 +558,7 @@ public:
* @return An extended meta factory for the parent type.
*/
template<auto Candidate, typename Policy = as_is_t>
auto func(const id_type id) ENTT_NOEXCEPT {
auto func(const id_type id) noexcept {
using descriptor = meta_function_helper_t<Type, decltype(Candidate)>;
static_assert(Policy::template value<typename descriptor::return_type>, "Invalid return type for the given policy");
@@ -594,7 +594,7 @@ private:
* @return A meta factory for the given type.
*/
template<typename Type>
[[nodiscard]] auto meta() ENTT_NOEXCEPT {
[[nodiscard]] auto meta() noexcept {
auto *const node = internal::meta_node<Type>::resolve();
// extended meta factory to allow assigning properties to opaque meta types
return meta_factory<Type, Type>{&node->prop};
@@ -611,7 +611,7 @@ template<typename Type>
*
* @param id Unique identifier.
*/
inline void meta_reset(const id_type id) ENTT_NOEXCEPT {
inline void meta_reset(const id_type id) noexcept {
auto clear_chain = [](auto **curr, auto... member) {
for(; *curr; *curr = std::exchange((*curr)->next, nullptr)) {
if constexpr(sizeof...(member) != 0u) {
@@ -647,7 +647,7 @@ inline void meta_reset(const id_type id) ENTT_NOEXCEPT {
* @tparam Type Type to reset.
*/
template<typename Type>
void meta_reset() ENTT_NOEXCEPT {
void meta_reset() noexcept {
meta_reset(internal::meta_node<Type>::resolve()->id);
}
@@ -656,7 +656,7 @@ void meta_reset() ENTT_NOEXCEPT {
*
* @sa meta_reset
*/
inline void meta_reset() ENTT_NOEXCEPT {
inline void meta_reset() noexcept {
while(*internal::meta_context::global()) {
meta_reset((*internal::meta_context::global())->id);
}

View File

@@ -36,7 +36,7 @@ public:
using iterator = meta_iterator;
/*! @brief Default constructor. */
meta_sequence_container() ENTT_NOEXCEPT = default;
meta_sequence_container() noexcept = default;
/**
* @brief Construct a proxy object for sequence containers.
@@ -44,7 +44,7 @@ public:
* @param instance The container to wrap.
*/
template<typename Type>
meta_sequence_container(std::in_place_type_t<Type>, any instance) ENTT_NOEXCEPT
meta_sequence_container(std::in_place_type_t<Type>, any instance) noexcept
: value_type_node{internal::meta_node<std::remove_cv_t<std::remove_reference_t<typename Type::value_type>>>::resolve()},
size_fn{&meta_sequence_container_traits<Type>::size},
resize_fn{&meta_sequence_container_traits<Type>::resize},
@@ -53,8 +53,8 @@ public:
erase_fn{&meta_sequence_container_traits<Type>::erase},
storage{std::move(instance)} {}
[[nodiscard]] inline meta_type value_type() const ENTT_NOEXCEPT;
[[nodiscard]] inline size_type size() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type value_type() const noexcept;
[[nodiscard]] inline size_type size() const noexcept;
inline bool resize(const size_type);
inline bool clear();
[[nodiscard]] inline iterator begin();
@@ -62,11 +62,11 @@ public:
inline iterator insert(iterator, meta_any);
inline iterator erase(iterator);
[[nodiscard]] inline meta_any operator[](const size_type);
[[nodiscard]] inline explicit operator bool() const ENTT_NOEXCEPT;
[[nodiscard]] inline explicit operator bool() const noexcept;
private:
internal::meta_type_node *value_type_node = nullptr;
size_type (*size_fn)(const any &) ENTT_NOEXCEPT = nullptr;
size_type (*size_fn)(const any &) noexcept = nullptr;
bool (*resize_fn)(any &, size_type) = nullptr;
iterator (*iter_fn)(any &, const bool) = nullptr;
iterator (*insert_fn)(any &, const std::ptrdiff_t, meta_any &) = nullptr;
@@ -85,7 +85,7 @@ public:
using iterator = meta_iterator;
/*! @brief Default constructor. */
meta_associative_container() ENTT_NOEXCEPT = default;
meta_associative_container() noexcept = default;
/**
* @brief Construct a proxy object for associative containers.
@@ -93,7 +93,7 @@ public:
* @param instance The container to wrap.
*/
template<typename Type>
meta_associative_container(std::in_place_type_t<Type>, any instance) ENTT_NOEXCEPT
meta_associative_container(std::in_place_type_t<Type>, any instance) noexcept
: key_only_container{meta_associative_container_traits<Type>::key_only},
key_type_node{internal::meta_node<std::remove_cv_t<std::remove_reference_t<typename Type::key_type>>>::resolve()},
mapped_type_node{nullptr},
@@ -110,25 +110,25 @@ public:
}
}
[[nodiscard]] inline bool key_only() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type key_type() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type mapped_type() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type value_type() const ENTT_NOEXCEPT;
[[nodiscard]] inline size_type size() const ENTT_NOEXCEPT;
[[nodiscard]] inline bool key_only() const noexcept;
[[nodiscard]] inline meta_type key_type() const noexcept;
[[nodiscard]] inline meta_type mapped_type() const noexcept;
[[nodiscard]] inline meta_type value_type() const noexcept;
[[nodiscard]] inline size_type size() const noexcept;
inline bool clear();
[[nodiscard]] inline iterator begin();
[[nodiscard]] inline iterator end();
inline bool insert(meta_any, meta_any);
inline bool erase(meta_any);
[[nodiscard]] inline iterator find(meta_any);
[[nodiscard]] inline explicit operator bool() const ENTT_NOEXCEPT;
[[nodiscard]] inline explicit operator bool() const noexcept;
private:
bool key_only_container{};
internal::meta_type_node *key_type_node = nullptr;
internal::meta_type_node *mapped_type_node = nullptr;
internal::meta_type_node *value_type_node = nullptr;
size_type (*size_fn)(const any &) ENTT_NOEXCEPT = nullptr;
size_type (*size_fn)(const any &) noexcept = nullptr;
bool (*clear_fn)(any &) = nullptr;
iterator (*iter_fn)(any &, const bool) = nullptr;
bool (*insert_fn)(any &, meta_any &, meta_any &) = nullptr;
@@ -190,14 +190,14 @@ class meta_any {
}
}
meta_any(const meta_any &other, any ref) ENTT_NOEXCEPT
meta_any(const meta_any &other, any ref) noexcept
: storage{std::move(ref)},
node{storage ? other.node : nullptr},
vtable{storage ? other.vtable : &basic_vtable<void>} {}
public:
/*! @brief Default constructor. */
meta_any() ENTT_NOEXCEPT
meta_any() noexcept
: storage{},
node{},
vtable{&basic_vtable<void>} {}
@@ -233,7 +233,7 @@ public:
* @brief Move constructor.
* @param other The instance to move from.
*/
meta_any(meta_any &&other) ENTT_NOEXCEPT
meta_any(meta_any &&other) noexcept
: storage{std::move(other.storage)},
node{std::exchange(other.node, nullptr)},
vtable{std::exchange(other.vtable, &basic_vtable<void>)} {}
@@ -261,7 +261,7 @@ public:
* @param other The instance to move from.
* @return This meta any object.
*/
meta_any &operator=(meta_any &&other) ENTT_NOEXCEPT {
meta_any &operator=(meta_any &&other) noexcept {
release();
vtable = std::exchange(other.vtable, &basic_vtable<void>);
storage = std::move(other.storage);
@@ -283,15 +283,15 @@ public:
}
/*! @copydoc any::type */
[[nodiscard]] inline meta_type type() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type type() const noexcept;
/*! @copydoc any::data */
[[nodiscard]] const void *data() const ENTT_NOEXCEPT {
[[nodiscard]] const void *data() const noexcept {
return storage.data();
}
/*! @copydoc any::data */
[[nodiscard]] void *data() ENTT_NOEXCEPT {
[[nodiscard]] void *data() noexcept {
return storage.data();
}
@@ -475,7 +475,7 @@ public:
* @brief Returns a sequence container proxy.
* @return A sequence container proxy for the underlying object.
*/
[[nodiscard]] meta_sequence_container as_sequence_container() ENTT_NOEXCEPT {
[[nodiscard]] meta_sequence_container as_sequence_container() noexcept {
any detached = storage.as_ref();
meta_sequence_container proxy;
vtable(operation::seq, detached, &proxy);
@@ -483,7 +483,7 @@ public:
}
/*! @copydoc as_sequence_container */
[[nodiscard]] meta_sequence_container as_sequence_container() const ENTT_NOEXCEPT {
[[nodiscard]] meta_sequence_container as_sequence_container() const noexcept {
any detached = storage.as_ref();
meta_sequence_container proxy;
vtable(operation::seq, detached, &proxy);
@@ -494,7 +494,7 @@ public:
* @brief Returns an associative container proxy.
* @return An associative container proxy for the underlying object.
*/
[[nodiscard]] meta_associative_container as_associative_container() ENTT_NOEXCEPT {
[[nodiscard]] meta_associative_container as_associative_container() noexcept {
any detached = storage.as_ref();
meta_associative_container proxy;
vtable(operation::assoc, detached, &proxy);
@@ -502,7 +502,7 @@ public:
}
/*! @copydoc as_associative_container */
[[nodiscard]] meta_associative_container as_associative_container() const ENTT_NOEXCEPT {
[[nodiscard]] meta_associative_container as_associative_container() const noexcept {
any detached = storage.as_ref();
meta_associative_container proxy;
vtable(operation::assoc, detached, &proxy);
@@ -514,7 +514,7 @@ public:
* @return A wrapper that shares a reference to an unmanaged object if the
* wrapped element is dereferenceable, an invalid meta any otherwise.
*/
[[nodiscard]] meta_any operator*() const ENTT_NOEXCEPT {
[[nodiscard]] meta_any operator*() const noexcept {
meta_any ret{};
vtable(operation::deref, storage, &ret);
return ret;
@@ -524,7 +524,7 @@ public:
* @brief Returns false if a wrapper is invalid, true otherwise.
* @return False if the wrapper is invalid, true otherwise.
*/
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] explicit operator bool() const noexcept {
return !(node == nullptr);
}
@@ -534,17 +534,17 @@ public:
}
/*! @copydoc any::as_ref */
[[nodiscard]] meta_any as_ref() ENTT_NOEXCEPT {
[[nodiscard]] meta_any as_ref() noexcept {
return meta_any{*this, storage.as_ref()};
}
/*! @copydoc any::as_ref */
[[nodiscard]] meta_any as_ref() const ENTT_NOEXCEPT {
[[nodiscard]] meta_any as_ref() const noexcept {
return meta_any{*this, storage.as_ref()};
}
/*! @copydoc any::owner */
[[nodiscard]] bool owner() const ENTT_NOEXCEPT {
[[nodiscard]] bool owner() const noexcept {
return storage.owner();
}
@@ -560,7 +560,7 @@ private:
* @param rhs A wrapper, either empty or not.
* @return True if the two wrappers differ in their content, false otherwise.
*/
[[nodiscard]] inline bool operator!=(const meta_any &lhs, const meta_any &rhs) ENTT_NOEXCEPT {
[[nodiscard]] inline bool operator!=(const meta_any &lhs, const meta_any &rhs) noexcept {
return !(lhs == rhs);
}
@@ -623,7 +623,7 @@ struct meta_handle {
* @param value An instance of an object to use to initialize the handle.
*/
template<typename Type, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Type>, meta_handle>>>
meta_handle(Type &value) ENTT_NOEXCEPT
meta_handle(Type &value) noexcept
: meta_handle{} {
if constexpr(std::is_same_v<std::decay_t<Type>, meta_any>) {
any = value.as_ref();
@@ -636,7 +636,7 @@ struct meta_handle {
* @brief Returns false if a handle is invalid, true otherwise.
* @return False if the handle is invalid, true otherwise.
*/
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] explicit operator bool() const noexcept {
return static_cast<bool>(any);
}
@@ -666,7 +666,7 @@ struct meta_prop {
* @brief Constructs an instance from a given node.
* @param curr The underlying node with which to construct the instance.
*/
meta_prop(const node_type *curr = nullptr) ENTT_NOEXCEPT
meta_prop(const node_type *curr = nullptr) noexcept
: node{curr} {}
/**
@@ -689,7 +689,7 @@ struct meta_prop {
* @brief Returns true if an object is valid, false otherwise.
* @return True if the object is valid, false otherwise.
*/
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] explicit operator bool() const noexcept {
return !(node == nullptr);
}
@@ -705,11 +705,11 @@ struct meta_data {
using size_type = typename node_type::size_type;
/*! @copydoc meta_prop::meta_prop */
meta_data(const node_type *curr = nullptr) ENTT_NOEXCEPT
meta_data(const node_type *curr = nullptr) noexcept
: node{curr} {}
/*! @copydoc meta_type::id */
[[nodiscard]] id_type id() const ENTT_NOEXCEPT {
[[nodiscard]] id_type id() const noexcept {
return node->id;
}
@@ -717,7 +717,7 @@ struct meta_data {
* @brief Returns the number of setters available.
* @return The number of setters available.
*/
[[nodiscard]] size_type arity() const ENTT_NOEXCEPT {
[[nodiscard]] size_type arity() const noexcept {
return node->arity;
}
@@ -725,7 +725,7 @@ struct meta_data {
* @brief Indicates whether a data member is constant or not.
* @return True if the data member is constant, false otherwise.
*/
[[nodiscard]] bool is_const() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_const() const noexcept {
return !!(node->traits & internal::meta_traits::is_const);
}
@@ -733,12 +733,12 @@ struct meta_data {
* @brief Indicates whether a data member is static or not.
* @return True if the data member is static, false otherwise.
*/
[[nodiscard]] bool is_static() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_static() const noexcept {
return !!(node->traits & internal::meta_traits::is_static);
}
/*! @copydoc meta_any::type */
[[nodiscard]] inline meta_type type() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type type() const noexcept;
/**
* @brief Sets the value of a given variable.
@@ -776,13 +776,13 @@ struct meta_data {
* @param index Index of the setter of which to return the accepted type.
* @return The type accepted by the i-th setter.
*/
[[nodiscard]] inline meta_type arg(const size_type index) const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type arg(const size_type index) const noexcept;
/**
* @brief Returns a range to visit registered meta properties.
* @return An iterable range to visit registered meta properties.
*/
[[nodiscard]] meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_prop> prop() const noexcept {
return node->prop;
}
@@ -805,7 +805,7 @@ struct meta_data {
* @brief Returns true if an object is valid, false otherwise.
* @return True if the object is valid, false otherwise.
*/
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] explicit operator bool() const noexcept {
return !(node == nullptr);
}
@@ -821,11 +821,11 @@ struct meta_func {
using size_type = typename node_type::size_type;
/*! @copydoc meta_prop::meta_prop */
meta_func(const node_type *curr = nullptr) ENTT_NOEXCEPT
meta_func(const node_type *curr = nullptr) noexcept
: node{curr} {}
/*! @copydoc meta_type::id */
[[nodiscard]] id_type id() const ENTT_NOEXCEPT {
[[nodiscard]] id_type id() const noexcept {
return node->id;
}
@@ -833,7 +833,7 @@ struct meta_func {
* @brief Returns the number of arguments accepted by a member function.
* @return The number of arguments accepted by the member function.
*/
[[nodiscard]] size_type arity() const ENTT_NOEXCEPT {
[[nodiscard]] size_type arity() const noexcept {
return node->arity;
}
@@ -841,7 +841,7 @@ struct meta_func {
* @brief Indicates whether a member function is constant or not.
* @return True if the member function is constant, false otherwise.
*/
[[nodiscard]] bool is_const() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_const() const noexcept {
return !!(node->traits & internal::meta_traits::is_const);
}
@@ -849,7 +849,7 @@ struct meta_func {
* @brief Indicates whether a member function is static or not.
* @return True if the member function is static, false otherwise.
*/
[[nodiscard]] bool is_static() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_static() const noexcept {
return !!(node->traits & internal::meta_traits::is_static);
}
@@ -857,14 +857,14 @@ struct meta_func {
* @brief Returns the return type of a member function.
* @return The return type of the member function.
*/
[[nodiscard]] inline meta_type ret() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type ret() const noexcept;
/**
* @brief Returns the type of the i-th argument of a member function.
* @param index Index of the argument of which to return the type.
* @return The type of the i-th argument of a member function.
*/
[[nodiscard]] inline meta_type arg(const size_type index) const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type arg(const size_type index) const noexcept;
/**
* @brief Invokes the underlying function, if possible.
@@ -901,7 +901,7 @@ struct meta_func {
}
/*! @copydoc meta_data::prop */
[[nodiscard]] meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_prop> prop() const noexcept {
return node->prop;
}
@@ -924,7 +924,7 @@ struct meta_func {
* @brief Returns true if an object is valid, false otherwise.
* @return True if the object is valid, false otherwise.
*/
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] explicit operator bool() const noexcept {
return !(node == nullptr);
}
@@ -982,21 +982,21 @@ public:
using size_type = typename node_type::size_type;
/*! @copydoc meta_prop::meta_prop */
meta_type(const node_type *curr = nullptr) ENTT_NOEXCEPT
meta_type(const node_type *curr = nullptr) noexcept
: node{curr} {}
/**
* @brief Constructs an instance from a given base node.
* @param curr The base node with which to construct the instance.
*/
meta_type(const base_node_type *curr) ENTT_NOEXCEPT
meta_type(const base_node_type *curr) noexcept
: node{curr ? curr->type : nullptr} {}
/**
* @brief Returns the type info object of the underlying type.
* @return The type info object of the underlying type.
*/
[[nodiscard]] const type_info &info() const ENTT_NOEXCEPT {
[[nodiscard]] const type_info &info() const noexcept {
return *node->info;
}
@@ -1004,7 +1004,7 @@ public:
* @brief Returns the identifier assigned to a type.
* @return The identifier assigned to the type.
*/
[[nodiscard]] id_type id() const ENTT_NOEXCEPT {
[[nodiscard]] id_type id() const noexcept {
return node->id;
}
@@ -1012,7 +1012,7 @@ public:
* @brief Returns the size of the underlying type if known.
* @return The size of the underlying type if known, 0 otherwise.
*/
[[nodiscard]] size_type size_of() const ENTT_NOEXCEPT {
[[nodiscard]] size_type size_of() const noexcept {
return node->size_of;
}
@@ -1021,7 +1021,7 @@ public:
* @return True if the underlying type is an arithmetic type, false
* otherwise.
*/
[[nodiscard]] bool is_arithmetic() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_arithmetic() const noexcept {
return !!(node->traits & internal::meta_traits::is_arithmetic);
}
@@ -1029,7 +1029,7 @@ public:
* @brief Checks whether a type refers to an array type or not.
* @return True if the underlying type is an array type, false otherwise.
*/
[[nodiscard]] bool is_array() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_array() const noexcept {
return !!(node->traits & internal::meta_traits::is_array);
}
@@ -1037,7 +1037,7 @@ public:
* @brief Checks whether a type refers to an enum or not.
* @return True if the underlying type is an enum, false otherwise.
*/
[[nodiscard]] bool is_enum() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_enum() const noexcept {
return !!(node->traits & internal::meta_traits::is_enum);
}
@@ -1045,7 +1045,7 @@ public:
* @brief Checks whether a type refers to a class or not.
* @return True if the underlying type is a class, false otherwise.
*/
[[nodiscard]] bool is_class() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_class() const noexcept {
return !!(node->traits & internal::meta_traits::is_class);
}
@@ -1053,7 +1053,7 @@ public:
* @brief Checks whether a type refers to a pointer or not.
* @return True if the underlying type is a pointer, false otherwise.
*/
[[nodiscard]] bool is_pointer() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_pointer() const noexcept {
return !!(node->traits & internal::meta_traits::is_pointer);
}
@@ -1062,7 +1062,7 @@ public:
* @return The type for which the pointer is defined or this type if it
* doesn't refer to a pointer type.
*/
[[nodiscard]] meta_type remove_pointer() const ENTT_NOEXCEPT {
[[nodiscard]] meta_type remove_pointer() const noexcept {
return node->remove_pointer();
}
@@ -1071,7 +1071,7 @@ public:
* @return True if the underlying type is a pointer-like one, false
* otherwise.
*/
[[nodiscard]] bool is_pointer_like() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_pointer_like() const noexcept {
return !!(node->traits & internal::meta_traits::is_meta_pointer_like);
}
@@ -1079,7 +1079,7 @@ public:
* @brief Checks whether a type refers to a sequence container or not.
* @return True if the type is a sequence container, false otherwise.
*/
[[nodiscard]] bool is_sequence_container() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_sequence_container() const noexcept {
return !!(node->traits & internal::meta_traits::is_meta_sequence_container);
}
@@ -1087,7 +1087,7 @@ public:
* @brief Checks whether a type refers to an associative container or not.
* @return True if the type is an associative container, false otherwise.
*/
[[nodiscard]] bool is_associative_container() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_associative_container() const noexcept {
return !!(node->traits & internal::meta_traits::is_meta_associative_container);
}
@@ -1097,7 +1097,7 @@ public:
* @return True if the type is a recognized class template specialization,
* false otherwise.
*/
[[nodiscard]] bool is_template_specialization() const ENTT_NOEXCEPT {
[[nodiscard]] bool is_template_specialization() const noexcept {
return (node->templ != nullptr);
}
@@ -1105,7 +1105,7 @@ public:
* @brief Returns the number of template arguments.
* @return The number of template arguments.
*/
[[nodiscard]] size_type template_arity() const ENTT_NOEXCEPT {
[[nodiscard]] size_type template_arity() const noexcept {
return node->templ ? node->templ->arity : size_type{};
}
@@ -1116,7 +1116,7 @@ public:
*
* @return The tag for the class template of the underlying type.
*/
[[nodiscard]] inline meta_type template_type() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type template_type() const noexcept {
return node->templ ? node->templ->type : meta_type{};
}
@@ -1125,7 +1125,7 @@ public:
* @param index Index of the template argument of which to return the type.
* @return The type of the i-th template argument of a type.
*/
[[nodiscard]] inline meta_type template_arg(const size_type index) const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type template_arg(const size_type index) const noexcept {
return index < template_arity() ? node->templ->arg(index) : meta_type{};
}
@@ -1133,7 +1133,7 @@ public:
* @brief Returns a range to visit registered top-level base meta types.
* @return An iterable range to visit registered top-level base meta types.
*/
[[nodiscard]] meta_range<meta_type, internal::meta_base_node> base() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_type, internal::meta_base_node> base() const noexcept {
return node->base;
}
@@ -1150,7 +1150,7 @@ public:
* @brief Returns a range to visit registered top-level meta data.
* @return An iterable range to visit registered top-level meta data.
*/
[[nodiscard]] meta_range<meta_data> data() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_data> data() const noexcept {
return node->data;
}
@@ -1170,7 +1170,7 @@ public:
* @brief Returns a range to visit registered top-level functions.
* @return An iterable range to visit registered top-level functions.
*/
[[nodiscard]] meta_range<meta_func> func() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_func> func() const noexcept {
return node->func;
}
@@ -1299,7 +1299,7 @@ public:
* @brief Returns a range to visit registered top-level meta properties.
* @return An iterable range to visit registered top-level meta properties.
*/
[[nodiscard]] meta_range<meta_prop> prop() const ENTT_NOEXCEPT {
[[nodiscard]] meta_range<meta_prop> prop() const noexcept {
return node->prop;
}
@@ -1319,7 +1319,7 @@ public:
* @brief Returns true if an object is valid, false otherwise.
* @return True if the object is valid, false otherwise.
*/
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] explicit operator bool() const noexcept {
return !(node == nullptr);
}
@@ -1328,7 +1328,7 @@ public:
* @param other The object with which to compare.
* @return True if the objects refer to the same type, false otherwise.
*/
[[nodiscard]] bool operator==(const meta_type &other) const ENTT_NOEXCEPT {
[[nodiscard]] bool operator==(const meta_type &other) const noexcept {
return (!node && !other.node) || (node && other.node && *node->info == *other.node->info);
}
@@ -1342,11 +1342,11 @@ private:
* @param rhs An object, either valid or not.
* @return False if the objects refer to the same node, true otherwise.
*/
[[nodiscard]] inline bool operator!=(const meta_type &lhs, const meta_type &rhs) ENTT_NOEXCEPT {
[[nodiscard]] inline bool operator!=(const meta_type &lhs, const meta_type &rhs) noexcept {
return !(lhs == rhs);
}
[[nodiscard]] inline meta_type meta_any::type() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type meta_any::type() const noexcept {
return node;
}
@@ -1417,19 +1417,19 @@ inline bool meta_any::assign(meta_any &&other) {
return assign(std::as_const(other));
}
[[nodiscard]] inline meta_type meta_data::type() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type meta_data::type() const noexcept {
return node->type;
}
[[nodiscard]] inline meta_type meta_func::ret() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type meta_func::ret() const noexcept {
return node->ret;
}
[[nodiscard]] inline meta_type meta_data::arg(const size_type index) const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type meta_data::arg(const size_type index) const noexcept {
return index < arity() ? node->arg(index) : meta_type{};
}
[[nodiscard]] inline meta_type meta_func::arg(const size_type index) const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type meta_func::arg(const size_type index) const noexcept {
return index < arity() ? node->arg(index) : meta_type{};
}
@@ -1455,32 +1455,32 @@ public:
using reference = value_type;
using iterator_category = std::input_iterator_tag;
constexpr meta_iterator() ENTT_NOEXCEPT
constexpr meta_iterator() noexcept
: deref{},
offset{},
handle{} {}
template<typename Type>
explicit meta_iterator(Type &cont, const difference_type init) ENTT_NOEXCEPT
explicit meta_iterator(Type &cont, const difference_type init) noexcept
: deref{&deref_fn<decltype(cont.begin())>},
offset{init},
handle{cont.begin()} {}
meta_iterator &operator++() ENTT_NOEXCEPT {
meta_iterator &operator++() noexcept {
return ++offset, *this;
}
meta_iterator operator++(int value) ENTT_NOEXCEPT {
meta_iterator operator++(int value) noexcept {
meta_iterator orig = *this;
offset += ++value;
return orig;
}
meta_iterator &operator--() ENTT_NOEXCEPT {
meta_iterator &operator--() noexcept {
return --offset, *this;
}
meta_iterator operator--(int value) ENTT_NOEXCEPT {
meta_iterator operator--(int value) noexcept {
meta_iterator orig = *this;
offset -= ++value;
return orig;
@@ -1494,15 +1494,15 @@ public:
return operator*();
}
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] explicit operator bool() const noexcept {
return static_cast<bool>(handle);
}
[[nodiscard]] bool operator==(const meta_iterator &other) const ENTT_NOEXCEPT {
[[nodiscard]] bool operator==(const meta_iterator &other) const noexcept {
return offset == other.offset;
}
[[nodiscard]] bool operator!=(const meta_iterator &other) const ENTT_NOEXCEPT {
[[nodiscard]] bool operator!=(const meta_iterator &other) const noexcept {
return !(*this == other);
}
@@ -1545,21 +1545,21 @@ public:
using reference = value_type;
using iterator_category = std::input_iterator_tag;
constexpr meta_iterator() ENTT_NOEXCEPT
constexpr meta_iterator() noexcept
: vtable{},
handle{} {}
template<bool KeyOnly, typename It>
meta_iterator(std::integral_constant<bool, KeyOnly>, It iter) ENTT_NOEXCEPT
meta_iterator(std::integral_constant<bool, KeyOnly>, It iter) noexcept
: vtable{&basic_vtable<KeyOnly, It>},
handle{std::move(iter)} {}
meta_iterator &operator++() ENTT_NOEXCEPT {
meta_iterator &operator++() noexcept {
vtable(operation::incr, handle, nullptr);
return *this;
}
meta_iterator operator++(int) ENTT_NOEXCEPT {
meta_iterator operator++(int) noexcept {
meta_iterator orig = *this;
return ++(*this), orig;
}
@@ -1574,15 +1574,15 @@ public:
return operator*();
}
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] explicit operator bool() const noexcept {
return static_cast<bool>(handle);
}
[[nodiscard]] bool operator==(const meta_iterator &other) const ENTT_NOEXCEPT {
[[nodiscard]] bool operator==(const meta_iterator &other) const noexcept {
return handle == other.handle;
}
[[nodiscard]] bool operator!=(const meta_iterator &other) const ENTT_NOEXCEPT {
[[nodiscard]] bool operator!=(const meta_iterator &other) const noexcept {
return !(*this == other);
}
@@ -1600,7 +1600,7 @@ private:
* @brief Returns the meta value type of a container.
* @return The meta value type of the container.
*/
[[nodiscard]] inline meta_type meta_sequence_container::value_type() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type meta_sequence_container::value_type() const noexcept {
return value_type_node;
}
@@ -1608,7 +1608,7 @@ private:
* @brief Returns the size of a container.
* @return The size of the container.
*/
[[nodiscard]] inline meta_sequence_container::size_type meta_sequence_container::size() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_sequence_container::size_type meta_sequence_container::size() const noexcept {
return size_fn(storage);
}
@@ -1680,7 +1680,7 @@ inline meta_sequence_container::iterator meta_sequence_container::erase(iterator
* @brief Returns false if a proxy is invalid, true otherwise.
* @return False if the proxy is invalid, true otherwise.
*/
[[nodiscard]] inline meta_sequence_container::operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_sequence_container::operator bool() const noexcept {
return static_cast<bool>(storage);
}
@@ -1688,7 +1688,7 @@ inline meta_sequence_container::iterator meta_sequence_container::erase(iterator
* @brief Returns true if a container is also key-only, false otherwise.
* @return True if the associative container is also key-only, false otherwise.
*/
[[nodiscard]] inline bool meta_associative_container::key_only() const ENTT_NOEXCEPT {
[[nodiscard]] inline bool meta_associative_container::key_only() const noexcept {
return key_only_container;
}
@@ -1696,7 +1696,7 @@ inline meta_sequence_container::iterator meta_sequence_container::erase(iterator
* @brief Returns the meta key type of a container.
* @return The meta key type of the a container.
*/
[[nodiscard]] inline meta_type meta_associative_container::key_type() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type meta_associative_container::key_type() const noexcept {
return key_type_node;
}
@@ -1704,17 +1704,17 @@ inline meta_sequence_container::iterator meta_sequence_container::erase(iterator
* @brief Returns the meta mapped type of a container.
* @return The meta mapped type of the a container.
*/
[[nodiscard]] inline meta_type meta_associative_container::mapped_type() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type meta_associative_container::mapped_type() const noexcept {
return mapped_type_node;
}
/*! @copydoc meta_sequence_container::value_type */
[[nodiscard]] inline meta_type meta_associative_container::value_type() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type meta_associative_container::value_type() const noexcept {
return value_type_node;
}
/*! @copydoc meta_sequence_container::size */
[[nodiscard]] inline meta_associative_container::size_type meta_associative_container::size() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_associative_container::size_type meta_associative_container::size() const noexcept {
return size_fn(storage);
}
@@ -1765,7 +1765,7 @@ inline bool meta_associative_container::erase(meta_any key) {
* @brief Returns false if a proxy is invalid, true otherwise.
* @return False if the proxy is invalid, true otherwise.
*/
[[nodiscard]] inline meta_associative_container::operator bool() const ENTT_NOEXCEPT {
[[nodiscard]] inline meta_associative_container::operator bool() const noexcept {
return static_cast<bool>(storage);
}

View File

@@ -4,7 +4,6 @@
#include <cstddef>
#include <type_traits>
#include <utility>
#include "../config/config.h"
#include "../core/attribute.h"
#include "../core/enum.hpp"
#include "../core/fwd.hpp"
@@ -51,7 +50,7 @@ struct meta_prop_node {
struct meta_base_node {
meta_base_node *next;
meta_type_node *const type;
meta_any (*const cast)(meta_any) ENTT_NOEXCEPT;
meta_any (*const cast)(meta_any) noexcept;
};
struct meta_conv_node {
@@ -64,7 +63,7 @@ struct meta_ctor_node {
using size_type = std::size_t;
meta_ctor_node *next;
const size_type arity;
meta_type (*const arg)(const size_type) ENTT_NOEXCEPT;
meta_type (*const arg)(const size_type) noexcept;
meta_any (*const invoke)(meta_any *const);
};
@@ -76,7 +75,7 @@ struct meta_data_node {
meta_prop_node *prop;
const size_type arity;
meta_type_node *const type;
meta_type (*const arg)(const size_type) ENTT_NOEXCEPT;
meta_type (*const arg)(const size_type) noexcept;
bool (*const set)(meta_handle, meta_any);
meta_any (*const get)(meta_handle);
};
@@ -89,7 +88,7 @@ struct meta_func_node {
meta_prop_node *prop;
const size_type arity;
meta_type_node *const ret;
meta_type (*const arg)(const size_type) ENTT_NOEXCEPT;
meta_type (*const arg)(const size_type) noexcept;
meta_any (*const invoke)(meta_handle, meta_any *const);
};
@@ -97,7 +96,7 @@ struct meta_template_node {
using size_type = std::size_t;
const size_type arity;
meta_type_node *const type;
meta_type_node *(*const arg)(const size_type)ENTT_NOEXCEPT;
meta_type_node *(*const arg)(const size_type) noexcept;
};
struct meta_type_node {
@@ -108,7 +107,7 @@ struct meta_type_node {
meta_type_node *next;
meta_prop_node *prop;
const size_type size_of;
meta_type_node *(*const remove_pointer)() ENTT_NOEXCEPT;
meta_type_node *(*const remove_pointer)() noexcept;
meta_any (*const default_constructor)();
double (*const conversion_helper)(void *, const void *);
const meta_template_node *const templ;
@@ -121,13 +120,13 @@ struct meta_type_node {
};
template<typename... Args>
meta_type_node *meta_arg_node(type_list<Args...>, const std::size_t index) ENTT_NOEXCEPT;
meta_type_node *meta_arg_node(type_list<Args...>, const std::size_t index) noexcept;
template<typename Type>
class ENTT_API meta_node {
static_assert(std::is_same_v<Type, std::remove_cv_t<std::remove_reference_t<Type>>>, "Invalid type");
[[nodiscard]] static auto *meta_default_constructor() ENTT_NOEXCEPT {
[[nodiscard]] static auto *meta_default_constructor() noexcept {
if constexpr(std::is_default_constructible_v<Type>) {
return +[]() { return meta_any{std::in_place_type<Type>}; };
} else {
@@ -135,7 +134,7 @@ class ENTT_API meta_node {
}
}
[[nodiscard]] static auto *meta_conversion_helper() ENTT_NOEXCEPT {
[[nodiscard]] static auto *meta_conversion_helper() noexcept {
if constexpr(std::is_arithmetic_v<Type>) {
return +[](void *bin, const void *value) {
return bin ? static_cast<double>(*static_cast<Type *>(bin) = static_cast<Type>(*static_cast<const double *>(value))) : static_cast<double>(*static_cast<const Type *>(value));
@@ -149,12 +148,12 @@ class ENTT_API meta_node {
}
}
[[nodiscard]] static meta_template_node *meta_template_info() ENTT_NOEXCEPT {
[[nodiscard]] static meta_template_node *meta_template_info() noexcept {
if constexpr(is_complete_v<meta_template_traits<Type>>) {
static meta_template_node node{
meta_template_traits<Type>::args_type::size,
meta_node<typename meta_template_traits<Type>::class_type>::resolve(),
[](const std::size_t index) ENTT_NOEXCEPT { return meta_arg_node(typename meta_template_traits<Type>::args_type{}, index); }
[](const std::size_t index) noexcept { return meta_arg_node(typename meta_template_traits<Type>::args_type{}, index); }
// tricks clang-format
};
@@ -165,7 +164,7 @@ class ENTT_API meta_node {
}
public:
[[nodiscard]] static meta_type_node *resolve() ENTT_NOEXCEPT {
[[nodiscard]] static meta_type_node *resolve() noexcept {
static meta_type_node node{
&type_id<Type>(),
{},
@@ -193,13 +192,13 @@ public:
};
template<typename... Args>
[[nodiscard]] meta_type_node *meta_arg_node(type_list<Args...>, const std::size_t index) ENTT_NOEXCEPT {
[[nodiscard]] meta_type_node *meta_arg_node(type_list<Args...>, const std::size_t index) noexcept {
meta_type_node *args[sizeof...(Args) + 1u]{nullptr, internal::meta_node<std::remove_cv_t<std::remove_reference_t<Args>>>::resolve()...};
return args[index + 1u];
}
template<auto Member, typename Type>
[[nodiscard]] static std::decay_t<decltype(std::declval<internal::meta_type_node>().*Member)> find_by(const Type &info_or_id, const internal::meta_type_node *node) ENTT_NOEXCEPT {
[[nodiscard]] static std::decay_t<decltype(std::declval<internal::meta_type_node>().*Member)> find_by(const Type &info_or_id, const internal::meta_type_node *node) noexcept {
for(auto *curr = node->*Member; curr; curr = curr->next) {
if constexpr(std::is_same_v<Type, type_info>) {
if(*curr->type->info == info_or_id) {

View File

@@ -23,34 +23,34 @@ struct meta_range_iterator final {
using iterator_category = std::input_iterator_tag;
using node_type = Node;
meta_range_iterator() ENTT_NOEXCEPT
meta_range_iterator() noexcept
: it{} {}
meta_range_iterator(node_type *head) ENTT_NOEXCEPT
meta_range_iterator(node_type *head) noexcept
: it{head} {}
meta_range_iterator &operator++() ENTT_NOEXCEPT {
meta_range_iterator &operator++() noexcept {
return (it = it->next), *this;
}
meta_range_iterator operator++(int) ENTT_NOEXCEPT {
meta_range_iterator operator++(int) noexcept {
meta_range_iterator orig = *this;
return ++(*this), orig;
}
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
[[nodiscard]] reference operator*() const noexcept {
return it;
}
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
[[nodiscard]] pointer operator->() const noexcept {
return operator*();
}
[[nodiscard]] bool operator==(const meta_range_iterator &other) const ENTT_NOEXCEPT {
[[nodiscard]] bool operator==(const meta_range_iterator &other) const noexcept {
return it == other.it;
}
[[nodiscard]] bool operator!=(const meta_range_iterator &other) const ENTT_NOEXCEPT {
[[nodiscard]] bool operator!=(const meta_range_iterator &other) const noexcept {
return !(*this == other);
}
@@ -80,25 +80,25 @@ struct meta_range final {
using const_iterator = iterator;
/*! @brief Default constructor. */
meta_range() ENTT_NOEXCEPT = default;
meta_range() noexcept = default;
/**
* @brief Constructs a meta range from a given node.
* @param head The underlying node with which to construct the range.
*/
meta_range(node_type *head) ENTT_NOEXCEPT
meta_range(node_type *head) noexcept
: node{head} {}
/**
* @brief Returns an iterator to the beginning.
* @return An iterator to the first meta object of the range.
*/
[[nodiscard]] const_iterator cbegin() const ENTT_NOEXCEPT {
[[nodiscard]] const_iterator cbegin() const noexcept {
return iterator{node};
}
/*! @copydoc cbegin */
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
[[nodiscard]] iterator begin() const noexcept {
return cbegin();
}
@@ -107,12 +107,12 @@ struct meta_range final {
* @return An iterator to the element following the last meta object of the
* range.
*/
[[nodiscard]] const_iterator cend() const ENTT_NOEXCEPT {
[[nodiscard]] const_iterator cend() const noexcept {
return iterator{};
}
/*! @copydoc cend */
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
[[nodiscard]] iterator end() const noexcept {
return cend();
}

View File

@@ -16,7 +16,7 @@ namespace entt {
* @return The meta type associated with the given type, if any.
*/
template<typename Type>
[[nodiscard]] meta_type resolve() ENTT_NOEXCEPT {
[[nodiscard]] meta_type resolve() noexcept {
return internal::meta_node<std::remove_cv_t<std::remove_reference_t<Type>>>::resolve();
}
@@ -24,7 +24,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.
*/
[[nodiscard]] inline meta_range<meta_type> resolve() ENTT_NOEXCEPT {
[[nodiscard]] inline meta_range<meta_type> resolve() noexcept {
return *internal::meta_context::global();
}
@@ -33,7 +33,7 @@ template<typename Type>
* @param id Unique identifier.
* @return The meta type associated with the given identifier, if any.
*/
[[nodiscard]] inline meta_type resolve(const id_type id) ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type resolve(const id_type id) noexcept {
for(auto &&curr: resolve()) {
if(curr.id() == id) {
return curr;
@@ -48,7 +48,7 @@ template<typename Type>
* @param info The type info object of the requested type.
* @return The meta type associated with the given type info object, if any.
*/
[[nodiscard]] inline meta_type resolve(const type_info &info) ENTT_NOEXCEPT {
[[nodiscard]] inline meta_type resolve(const type_info &info) noexcept {
for(auto &&curr: resolve()) {
if(curr.info() == info) {
return curr;

View File

@@ -5,7 +5,6 @@
#include <functional>
#include <type_traits>
#include <utility>
#include "../config/config.h"
#include "../core/type_traits.hpp"
#include "meta.hpp"
#include "node.hpp"
@@ -181,7 +180,7 @@ meta_any meta_dispatch([[maybe_unused]] Type &&value) {
* @return The meta type of the i-th element of the list of arguments.
*/
template<typename Type>
[[nodiscard]] static meta_type meta_arg(const std::size_t index) ENTT_NOEXCEPT {
[[nodiscard]] static meta_type meta_arg(const std::size_t index) noexcept {
return internal::meta_arg_node(Type{}, index);
}