E
E
Egorithm2020-05-15 10:00:20
C++ / C#
Egorithm, 2020-05-15 10:00:20

How to choose type at runtime?

I looked at type traits and RTTI , but as far as I understand, RTTI only determines the type, and type traits work only at compile-time.

For example, I get a value at runtime, and I need to define a variable of the required type depending on this. How?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2020-05-15
@EgoRusMarch

1. Pass information about the type in some form along with the value
2. Determine the type by the content, if possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question