samedi 17 avril 2021

Define C++ constants in preprocessor that are not basic types

I it possible to define C++ constants of complex types such as

#define std::map<std::size_t, double> SHELL_DISTANCE_MAP = {
    {0, SHELL_K_DISTANCE},
    {1, SHELL_K_DISTANCE},
    {2, SHELL_L_DISTANCE},
...

It's failing for me so I assume not. Yet, can you please confirm? Or is there an alternative? I need the above map as a global constant and do not want to create a custom class derived from map with static atributes.

Aucun commentaire:

Enregistrer un commentaire