typeinfo Questions
3
If you compile this file p3.cxx:
class foobarclass
{
public:
int i0;
};
void otherfun(void);
void mumble(void);
void fun(void)
{
try {
otherfun();
} catch(foobarclass &e) {
mumble();
...
2
Solved
I used typeid to get the type names of the std::vector::size_type and a zero sized class A with the following code (cppreference):
#include<iostream>
#include <vector>
#include <ty...
6
Solved
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:
std::type_info::name...
5
Solved
I want to get the type name and print it for debug purposes. I use the following code:
#include <cxxabi.h>
inline const char* demangle(const char *s) {
abi::__cxa_demangle(s, 0, 0, NU...
4
Basically, I want to get typeid(*this).name(), i.e. the real type of this.
I want to get this in GDB (without modifying the source code). I tried print typeid(*this) but it says that typeid is unk...
3
Solved
I have declared the following enum type in which I want the first member to have the ordinal value of 1 (one) rather than the usual 0 (zero):
type
TMyEnum = (
meFirstValue = 1,
meSecondValue,
...
3
TypeInfo(Type) returns the info about the specified type, is there any way to know the typeinfo of a var?
var
S: string;
Instance: IObjectType;
Obj: TDBGrid;
Info: PTypeInfo;
begin
Info:= Typ...
1
Solved
Here is a typical implementation of type_info::operator==:
#if _PLATFORM_SUPPORTS_UNIQUE_TYPEINFO
bool operator==(const type_info& __rhs) const {
return __mangled_name == __rhs.__mangled_nam...
1
So I have experimented on calling ITypeInfo on a VBA Class instance and whilst it looks promising I wanted to see if I could get a reference to its containing project, an analogue to a type library...
0
So I asked this question in a C# context and I have set bounty over there.
I have written an equivalent fragment of C++ code (to be housed within an ATL DLL project) to tap C++ developers experie...
1
For a piece of code that needs the type "family" of a generic type, I try to use the TypeInfo to retrieve the required information.
class function GetTypeKind<T>:TTypeKind;
For most types ...
Stinkstone asked 20/4, 2018 at 22:33
2
Solved
I am trying to create a std::unordered_map where the value is a std::type_index. The following snippet works:
std::unordered_map<std::type_index, int> workingMap;
workingMap[typeid(int)] = 1...
Antichrist asked 13/9, 2017 at 12:26
4
Solved
I have a program in which, partly for informational logging, I output the names of some classes as they are used (specifically I add an entry to a log saying along the lines of Messages::CSomeClass...
Nowise asked 29/11, 2011 at 9:46
3
Solved
I have need to print indented template names for debugging purposes.
For example, instead of single-line, I would like to indent name like this:
boost::phoenix::actor<
boost::phoenix::composit...
1
I'm looking for a way to load and inspect .rlib binaries generated by rustc. I've hunted around the standard library without much luck. My assumption is that an .rlib contains all the type informat...
Vamoose asked 7/7, 2014 at 5:39
3
The format of the output of type_info::name() is implementation specific.
namespace N { struct A; }
const N::A *a;
typeid(a).name(); // returns e.g. "const struct N::A" but compiler-specific
...
1
So, I've got an application that uses boost::asio. Due to complexity of the project, I cannot share it's source code, sadly :(
The application uses boost's asio lib to create some webservices. Whe...
Firecure asked 10/2, 2015 at 8:20
2
Solved
I'm having some trouble understanding the correspondance between the return type of typeid and actual type_info objects which seems to work differently from usual objects. For example, I can do...
...
1
Solved
Under what circumstances do extra grouping parentheses break things in C++ (C++11 specifically)? For reasons that are not relevant here, I ended up at one point with an expression that had an extra...
Maurine asked 2/2, 2014 at 21:41
3
Solved
I'm wondering if Qt provides an alternative to typeid to recognize variable types and get their name in a human-readable format.
My specific problem is the following:
struct gArgument{
QString t...
3
Solved
The std::type_info class is non-copyable. This makes it hard to store it in an object for later use. What should I do?
2
Solved
3
Solved
I am working on a method that is using reflection to inspect parameter types of methods. This methods iterates through the ParameterInfo's and is doing something with the types of those parameters....
Inflight asked 9/5, 2013 at 12:13
1
I was creating a template class that transforms a type into a string describing it, eg typeinfo<int(*)()>::name() returns the string "int(*)()" (up to whitespace). Initially I had tons of spe...
2
Solved
Lets say we have a class hierarchy. At the bottom we have Base and at the top Derived.
How to determine object class even if it is converted to base class pointer.
Base* b = new Derived():
typeid...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.