meta: adjust noexcept policy
This commit is contained in:
@@ -37,7 +37,7 @@ class meta_factory;
|
||||
*/
|
||||
template<typename Type, typename... Spec>
|
||||
class meta_factory<Type, Spec...>: public meta_factory<Type> {
|
||||
void link_prop_if_required(internal::meta_prop_node &node) {
|
||||
void link_prop_if_required(internal::meta_prop_node &node) ENTT_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;
|
||||
@@ -46,25 +46,25 @@ 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) {
|
||||
void unroll(choice_t<2>, std::tuple<Property...> property, Other &&...other) ENTT_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) {
|
||||
void unroll(choice_t<1>, std::pair<Property...> property, Other &&...other) ENTT_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) {
|
||||
void unroll(choice_t<0>, Property &&property, Other &&...other) ENTT_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>) {}
|
||||
void unroll(choice_t<0>) ENTT_NOEXCEPT {}
|
||||
|
||||
template<std::size_t = 0>
|
||||
void assign(meta_any key, meta_any value = {}) {
|
||||
@@ -138,28 +138,28 @@ private:
|
||||
*/
|
||||
template<typename Type>
|
||||
class meta_factory<Type> {
|
||||
void link_base_if_required(internal::meta_base_node &node) {
|
||||
void link_base_if_required(internal::meta_base_node &node) ENTT_NOEXCEPT {
|
||||
if(meta_range<internal::meta_base_node *, internal::meta_base_node> range{owner->base}; std::find(range.cbegin(), range.cend(), &node) == range.cend()) {
|
||||
node.next = owner->base;
|
||||
owner->base = &node;
|
||||
}
|
||||
}
|
||||
|
||||
void link_conv_if_required(internal::meta_conv_node &node) {
|
||||
void link_conv_if_required(internal::meta_conv_node &node) ENTT_NOEXCEPT {
|
||||
if(meta_range<internal::meta_conv_node *, internal::meta_conv_node> range{owner->conv}; std::find(range.cbegin(), range.cend(), &node) == range.cend()) {
|
||||
node.next = owner->conv;
|
||||
owner->conv = &node;
|
||||
}
|
||||
}
|
||||
|
||||
void link_ctor_if_required(internal::meta_ctor_node &node) {
|
||||
void link_ctor_if_required(internal::meta_ctor_node &node) ENTT_NOEXCEPT {
|
||||
if(meta_range<internal::meta_ctor_node *, internal::meta_ctor_node> range{owner->ctor}; std::find(range.cbegin(), range.cend(), &node) == range.cend()) {
|
||||
node.next = owner->ctor;
|
||||
owner->ctor = &node;
|
||||
}
|
||||
}
|
||||
|
||||
void link_data_if_required(const id_type id, internal::meta_data_node &node) {
|
||||
void link_data_if_required(const id_type id, internal::meta_data_node &node) ENTT_NOEXCEPT {
|
||||
meta_range<internal::meta_data_node *, internal::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;
|
||||
@@ -170,7 +170,7 @@ class meta_factory<Type> {
|
||||
}
|
||||
}
|
||||
|
||||
void link_func_if_required(const id_type id, internal::meta_func_node &node) {
|
||||
void link_func_if_required(const id_type id, internal::meta_func_node &node) ENTT_NOEXCEPT {
|
||||
node.id = id;
|
||||
|
||||
if(meta_range<internal::meta_func_node *, internal::meta_func_node> range{owner->func}; std::find(range.cbegin(), range.cend(), &node) == range.cend()) {
|
||||
@@ -205,7 +205,7 @@ class meta_factory<Type> {
|
||||
|
||||
public:
|
||||
/*! @brief Default constructor. */
|
||||
meta_factory()
|
||||
meta_factory() ENTT_NOEXCEPT
|
||||
: owner{internal::meta_node<Type>::resolve()} {}
|
||||
|
||||
/**
|
||||
@@ -213,7 +213,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()) {
|
||||
auto type(const id_type id = type_hash<Type>::value()) ENTT_NOEXCEPT {
|
||||
meta_range<internal::meta_type_node *, internal::meta_type_node> range{*internal::meta_context::global()};
|
||||
ENTT_ASSERT(std::find_if(range.cbegin(), range.cend(), [id, this](const auto *curr) { return curr != owner && curr->id == id; }) == range.cend(), "Duplicate identifier");
|
||||
owner->id = id;
|
||||
|
||||
@@ -1486,7 +1486,7 @@ public:
|
||||
* @param iter The actual iterator with which to build the meta iterator.
|
||||
*/
|
||||
template<typename It>
|
||||
explicit meta_iterator(It iter)
|
||||
explicit meta_iterator(It iter) ENTT_NOEXCEPT
|
||||
: vtable{&basic_vtable<It>},
|
||||
handle{std::move(iter)} {}
|
||||
|
||||
@@ -1515,7 +1515,7 @@ public:
|
||||
* @brief Access operator for accessing the pointed opaque object.
|
||||
* @return The element to which the iterator points.
|
||||
*/
|
||||
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] pointer operator->() const {
|
||||
return operator*();
|
||||
}
|
||||
|
||||
@@ -1693,7 +1693,7 @@ public:
|
||||
* @param iter The actual iterator with which to build the meta iterator.
|
||||
*/
|
||||
template<bool KeyOnly, typename It>
|
||||
meta_iterator(std::integral_constant<bool, KeyOnly>, It iter)
|
||||
meta_iterator(std::integral_constant<bool, KeyOnly>, It iter) ENTT_NOEXCEPT
|
||||
: vtable{&basic_vtable<KeyOnly, It>},
|
||||
handle{std::move(iter)} {}
|
||||
|
||||
@@ -1722,7 +1722,7 @@ public:
|
||||
* @brief Access operator for accessing the pointed opaque object.
|
||||
* @return The element to which the iterator points.
|
||||
*/
|
||||
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] pointer operator->() const {
|
||||
return operator*();
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ template<typename... Args>
|
||||
}
|
||||
|
||||
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) {
|
||||
[[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 {
|
||||
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) {
|
||||
|
||||
@@ -85,7 +85,7 @@ struct meta_range final {
|
||||
* @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)
|
||||
meta_range(node_type *head) ENTT_NOEXCEPT
|
||||
: node{head} {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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() {
|
||||
[[nodiscard]] inline meta_range<meta_type> resolve() ENTT_NOEXCEPT {
|
||||
return *internal::meta_context::global();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user