return an empty type for empty uvalues

This commit is contained in:
BlackMATov
2023-02-08 06:22:45 +07:00
parent 24657755eb
commit 178a4486cf
4 changed files with 7 additions and 9 deletions

View File

@@ -76,7 +76,7 @@ namespace meta_hpp
void reset();
void swap(uvalue& other) noexcept;
[[nodiscard]] const any_type& get_type() const noexcept;
[[nodiscard]] any_type get_type() const noexcept;
[[nodiscard]] void* get_data() noexcept;
[[nodiscard]] const void* get_data() const noexcept;

View File

@@ -345,10 +345,9 @@ namespace meta_hpp
vtable_t::do_swap(*this, other);
}
inline const any_type& uvalue::get_type() const noexcept {
static any_type void_type = resolve_type<void>();
inline any_type uvalue::get_type() const noexcept {
auto&& [tag, vtable] = vtable_t::unpack_vtag(*this);
return tag == storage_e::nothing ? void_type : vtable->type;
return tag == storage_e::nothing ? any_type{} : vtable->type;
}
inline void* uvalue::get_data() noexcept {