samedi 5 décembre 2015

Best way to initialize a "static const"-type variable member of a class in the main

I have a class that needs a static const variable member. The value for that class will be known at runtime by a user input. I have read a lot of post but so far none of the solution works. I am aware that this post:

Can I initialize a static const member at run-time in C++?

contains a work around, but it uses a global variable that I'd like to avoid.

I know another way involving creating a setting-type class but it is not very neat.

So if someone knows a simple solution, please let us know!

Aucun commentaire:

Enregistrer un commentaire