any: invoke type_id with decayed types to avoid unnecessary instantiations

This commit is contained in:
Michele Caini
2022-04-04 09:46:52 +02:00
parent 91d3349585
commit 976413173a

View File

@@ -104,8 +104,8 @@ class basic_any {
template<typename Type, typename... Args>
void initialize([[maybe_unused]] Args &&...args) {
if constexpr(!std::is_void_v<Type>) {
info = &type_id<std::remove_const_t<std::remove_reference_t<Type>>>();
vtable = basic_vtable<std::remove_const_t<std::remove_reference_t<Type>>>;
info = &type_id<Type>();
if constexpr(std::is_lvalue_reference_v<Type>) {
static_assert(sizeof...(Args) == 1u && (std::is_lvalue_reference_v<Args> && ...), "Invalid arguments");