No.
If your list of types you support can be finitely and centrally enumerated, std::variant
or boost::variant
or a roll-your-own can be used.
If your list of operations on the type you support can be finitely and centrally enumerated, std::any
or boost::any
together with type erasure techniques can be used to solve your problem. Here is an overly generic system to type erase nearly any single-dispatch operation.
You can use std::any
or boots::any
to have a non-centrally yet locally finitely enumerated list of types, but only the exact types known at each enumeration location are in play at that location.
You can do a combination of the above.
Failing that, you are entering the world of runtime compiling of dynamic C++ libraries and passing the result, and/orraw C++ with source code, around. Doing on the fly compiling.
All of this will depend on what your exact, actual problem is for which that you came up with this as a "solution"; there is probably going to be a related question for which your answer is "yes", and that related question is probably what you actually need to solve.
But the answer to your question as posed is simply "No".