meta: drop meta_sequence_container::meta_iterator::base()
This commit is contained in:
@@ -85,13 +85,13 @@ struct basic_meta_sequence_container_traits {
|
||||
return iterator{end(any_cast<const Type &>(container))};
|
||||
}
|
||||
|
||||
[[nodiscard]] static iterator insert([[maybe_unused]] any &container, [[maybe_unused]] iterator it, [[maybe_unused]] meta_any &value) {
|
||||
[[nodiscard]] static iterator insert([[maybe_unused]] any &container, [[maybe_unused]] const any &it, [[maybe_unused]] meta_any &value) {
|
||||
if constexpr(is_dynamic_sequence_container<Type>::value) {
|
||||
if(auto *const cont = any_cast<Type>(&container); cont) {
|
||||
// this abomination is necessary because only on macos value_type and const_reference are different types for std::vector<bool>
|
||||
if(value.allow_cast<typename Type::const_reference>() || value.allow_cast<typename Type::value_type>()) {
|
||||
const auto *element = value.try_cast<std::remove_reference_t<typename Type::const_reference>>();
|
||||
return iterator{cont->insert(any_cast<const typename Type::iterator &>(it.base()), element ? *element : value.cast<typename Type::value_type>())};
|
||||
return iterator{cont->insert(any_cast<const typename Type::iterator &>(it), element ? *element : value.cast<typename Type::value_type>())};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,10 +99,10 @@ struct basic_meta_sequence_container_traits {
|
||||
return {};
|
||||
}
|
||||
|
||||
[[nodiscard]] static iterator erase([[maybe_unused]] any &container, [[maybe_unused]] iterator it) {
|
||||
[[nodiscard]] static iterator erase([[maybe_unused]] any &container, [[maybe_unused]] const any &it) {
|
||||
if constexpr(is_dynamic_sequence_container<Type>::value) {
|
||||
if(auto *const cont = any_cast<Type>(&container); cont) {
|
||||
return iterator{cont->erase(any_cast<const typename Type::iterator &>(it.base()))};
|
||||
return iterator{cont->erase(any_cast<const typename Type::iterator &>(it))};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@ private:
|
||||
bool (*clear_fn)(any &) = nullptr;
|
||||
iterator (*begin_fn)(any &) = nullptr;
|
||||
iterator (*end_fn)(any &) = nullptr;
|
||||
iterator (*insert_fn)(any &, iterator, meta_any &) = nullptr;
|
||||
iterator (*erase_fn)(any &, iterator) = nullptr;
|
||||
iterator (*insert_fn)(any &, const any &, meta_any &) = nullptr;
|
||||
iterator (*erase_fn)(any &, const any &) = nullptr;
|
||||
meta_any (*get_fn)(any &, size_type) = nullptr;
|
||||
any storage{};
|
||||
};
|
||||
@@ -1440,6 +1440,9 @@ inline bool meta_any::assign(meta_any &&other) {
|
||||
|
||||
/*! @brief Opaque iterator for sequence containers. */
|
||||
class meta_sequence_container::meta_iterator final {
|
||||
/*! @brief Meta sequence containers are friends of their iterators. */
|
||||
friend class meta_sequence_container;
|
||||
|
||||
enum class operation : std::uint8_t {
|
||||
incr,
|
||||
deref
|
||||
@@ -1566,14 +1569,6 @@ public:
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the underlying iterator.
|
||||
* @return The underlying iterator.
|
||||
*/
|
||||
any base() const ENTT_NOEXCEPT {
|
||||
return handle.as_ref();
|
||||
}
|
||||
|
||||
private:
|
||||
vtable_type *vtable{};
|
||||
any handle{};
|
||||
@@ -1635,7 +1630,7 @@ inline bool meta_sequence_container::clear() {
|
||||
* @return A possibly invalid iterator to the inserted element.
|
||||
*/
|
||||
inline meta_sequence_container::iterator meta_sequence_container::insert(iterator it, meta_any value) {
|
||||
return insert_fn(storage, it, value);
|
||||
return insert_fn(storage, it.handle, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1644,7 +1639,7 @@ inline meta_sequence_container::iterator meta_sequence_container::insert(iterato
|
||||
* @return A possibly invalid iterator following the last removed element.
|
||||
*/
|
||||
inline meta_sequence_container::iterator meta_sequence_container::erase(iterator it) {
|
||||
return erase_fn(storage, it);
|
||||
return erase_fn(storage, it.handle);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user