How to conditionally set compiler optimization for template headers
问题 I found a question somewhat interesting, and went on an attempt to answer it. The author wants to compile -one- source file (which relies on template libraries) with AVX optimizations, and the rest of the project without those. So, to see what would happen, I've created a test project like this: main.cpp #include <iostream> #include <string> #include "fn_normal.h" #include "fn_avx.h" int main(int argc, char* argv[]) { int number = 10; // this will come from input, but let's keep it simple for