[SOLVED] Defining literals and constants based on namespaces.
I want to declare some constants which will represent iota for a class of Complex Numbers. The problem is that the default variable is represented by 'i', but engineers and physicists prefer to use 'j', as 'i' already represents current. So I wanted to declare my constants and related literal operators in such a way that whenever the program uses a particular namespace (let's say: engineer), the variables and literals are declared for j, and if not, the variables and literals are declared for i. This is my attempt : https://code.sololearn.com/cQaLGOq1z5AY/#cpp I wanted to use j for literals only when 'using namespace math::engineer' is used. But the issue is the #define from the engineer namespace is called even if the namespace isn't used. Is there any other way I can achieve what I want? Also, is there a pure C++ way to doing so? (using C++17 features available in GCC 8.2. I don't want to wait until C++20. )