rtti Questions
6
Solved
I'm using Visual Studio and performing a valid dynamic cast. RTTI is enabled.
Edit : Updated the code to be more realistic
struct base
{
virtual base* Clone()
{
base* ptr = new base;
CopyVa...
Slipknot asked 12/5, 2009 at 21:2
6
Solved
Although I'm doubtful, I'm curious as to whether it's possible to extract primitive-type template parameters from an existing type, perhaps using RTTI.
For example:
typedef std::bitset<16> ...
13
I understand that there is a resource hit from using RTTI, but how big is it? Everywhere I've looked just says that "RTTI is expensive," but none of them actually give any benchmarks or quantitativ...
Luvenialuwana asked 23/2, 2009 at 23:46
8
Almost every C++ resource I've seen that discusses this kind of thing tells me that I should prefer polymorphic approaches to using RTTI (run-time type identification). In general, I take this kind...
Vide asked 3/3, 2016 at 6:40
4
Solved
I've stored a pointer to a type_info object.
int MyVariable = 123;
const std::type_info* Datatype = &typeid(MyVariable);
How might I use this to typecast another variable to that type? I tri...
7
Solved
Considering such an enumeration :
type
TTypeOfData = (
[XmlName('ABC')] todABC,
[XmlName('DEF')] todDEF,
[XmlName('GHI')] todGHI
);
Where XmlName is a custom attribute used to define the s...
Bergstein asked 25/1, 2010 at 17:19
0
Today I met a weird behaviour in catching exceptions in C++, could anyone clarify it to me? Code snippe
#include <iostream>
#include <string>
#include <exception>
int main() {
...
2
Solved
If I have an interface such as:
IPluginAPI = interface
['{590DFF0B-CA00-46CC-84B0-3848103D4C5A}']
function add (a : double; b : double) : double;
function sub (a : double; b : double) : double;
...
3
Solved
I'm using gcc's -fno-rtti flag to compile my C++ without runtime type information.
Assuming I'm not using dynamic_cast<> or typeid(), is there anything that could lead me to later problems?
...
2
Solved
Let's see example classes. Base class is ITransport, transport class interface:
class ITransport {
public:
virtual void move(const Path& p) = 0;
virtual double estimateTime(const Path& p...
Hildegard asked 29/7, 2021 at 23:41
4
Solved
I'm curious to know what happens when compiling code with a dynamic cast whith RTTI disabled
(either with -fno-rttion GCC or with /GR- on visual studio). Does the compiler "falls back" to static_c...
Chaliapin asked 7/10, 2011 at 12:11
7
Solved
How come when I run this main.cpp:
#include <iostream>
#include <typeinfo>
using namespace std;
struct Blah {};
int main() {
cout << typeid(Blah).name() << endl;
retur...
2
Solved
Why are some properties repeated (such as Action and Align) where others are not (AlignWithMargins) when TRttiContext.GetType is called on a VCL Control?
uses
System.RTTI,
System.Generics.Collect...
Ambulant asked 20/9, 2020 at 19:57
6
Solved
According to this, void* has no RTTI information, therefore casting from void* is not legal and it make sense.
If I remember correctly, dynamic_cast from void* was working on gcc.
Can you please...
Punkie asked 9/11, 2010 at 6:36
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
Solved
I'm making a C++ library which relies heavily on RTTI (customizable bridge to another language) and is very confused about string literal type.
This is a simple test I made to show the problem:
s...
Accusation asked 12/6, 2019 at 14:15
2
Solved
My function module receives a table name and a column name at runtime.
I would like to get the length of the column: How many characters are allowed in the transparent table?
I used my favorite s...
3
Solved
I remember coding on platforms that had both RTTI and exceptions disabled, and on others that had them both enabled. However, I cannot remember coding on a platform that would enable one and disabl...
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...
3
Solved
If I want to use std::any I can use it with RTTI switched off. The following example compiles and runs as expected also with -fno-rtti with gcc.
int main()
{
std::any x;
x=9.9;
std::cout <&...
1
Solved
I was interested in performance question about determine type of object and write some benchmarks with 2 ways of determination.
Can someone explain me why variant with instanceof faster 350 times ...
Nipple asked 20/6, 2018 at 10:51
3
Solved
I have a Delphi generic class that exposes a function with an argument of the generic type. Inside this function, I need to pass an instance of the generic type on to another object expecting a Var...
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
8
In C++, is there any way to query the type of an object and then use that information to dynamically create a new object of the same type?
For example, say I have a simple 3 class hierarchy:
clas...
1
Solved
I have a project like this:
|--CMakeLists.txt(1)
|--File1.cpp -W -W-all
|--Folder1
|--CMakeLists.txt(2)
|--File2.cpp -W -W-all -fno-rtti
As you can see above, File2.cpp needs to compile with -...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.