As far as I understand, the implementation would have to store the size for each type (even for heavily template meta-programmed programs), which would incur overhead.

As workaround you could register the respective types with their sizes instead, e.g. in some kind of map.
 

-----Ursprüngliche Nachricht-----
Von: Frederick Virchanza Gotham via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Mo 31.07.2023 15:35
Betreff: [std-proposals] std::type_info::size()
An: std-proposals <std-proposals@lists.isocpp.org>;
CC: Frederick Virchanza Gotham <cauldwell.thomas@gmail.com>;
I just realised today that you can't get the size of a type from its type_info.

Really. . . . . . . ?

Surely we should be able to do:

void Func(std::type_info const &ti)
{
   cout << ti.size() << endl;
}
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals