typeinfo
C++: type_info to distinguish types
I know that compilers have much freedom in implementing std::type_info functions\' behavior. I\'m thinking about using it to compare object types, so I\'d like to be sure that:[详细]
2023-01-25 14:07 分类:问答Why is std::type_info polymorphic?
Is there a reason why std::type_info is specified to be polymorphic? The destructor is specified to be virtual (and there\'s a comment to the effect of \"so that it\'s polymorphic\" in The Design and[详细]
2023-01-19 09:58 分类:问答Trying to count instances of deriving classes, type_id doesn't work
I want to count all the instances of derivers from my class, I\'m trying to do it like so: .h file: #ifndef _Parant[详细]
2023-01-16 14:51 分类:问答Getting type of an object
I\'m trying to do something along these lines: int var = 5; std::numeric_limits<typeid(var)>::max();[详细]
2023-01-13 08:02 分类:问答Does C++11 provide hashing functions for std::type_info?
I\'m still working on a good solution to my One-Of-A-Type Container Problem -- and upon reflection I think it would be nice to be able to just use something like a std::map<std::type_info, boost::a[详细]
2023-01-13 06:39 分类:问答Why is type_info::name() unspecified?
I\'m fully aware that the return value of std::type_info::name() is implementation-defined. From the C++ standard (ISO/IEC 14882:2003 §18.5.1.7):[详细]
2023-01-13 04:18 分类:问答Enumerated types with specified values do not have TypeInfo, why? [duplicate]
This question already has answers here: Why do I get "type has no typeinfo" error with an enum type[详细]
2023-01-03 21:31 分类:问答g++ linker error--typeinfo, but not vtable
I know the standard answer for a linker error about missing typeinfo usually also involves vtable and some virtual function that I forgot to actually define.[详细]
2022-12-31 20:20 分类:问答storing a type's type for processing variable argument lists
Is it possible to do something along the lines of: type t = int;//this would be a function which identifies what type the next argument is[详细]
2022-12-18 06:59 分类:问答What's the lifetime of memory pointed to typeinfo::name()?
In C++ I can use typeid operator to retrieve the name of any polymorphic class: const char* name = typeid( CMyClass ).name();[详细]
2022-12-17 11:40 分类:问答