I want to use preprocessor command to control code executive path. Because in this way can save runtime time.
#if (sizeof(T)==1
doesn\'t comple with error:
As @some-programmer-dude mentioned in the comment, sizeof
is not part of the preprocessor.
you should use if constexpr
if you want it to work in compile time.
if you don't care if it happens in compile time or run-time just use a regular if
statment
keep in mind that if constexpr
is a new feature in C++17!