I made an framework (Boost-based), but I have the following problem: if an variable is something do something, if is another something do another thing. But else, I need to give an error to the compiler. How can I do this?
I think that you won't need to see this, but if you want...
lang has no value at compile-time, so how would the compiler be able to check it and issue in error if it is an incorrect value?
One simple strategy is to use #defines and a preprocessor check that conditionally uses #error. I'm almost sure there are some C++11 features that can help you here if you put the value of lang in a constexpr variable somewhere.
If you want to have the compiler get an error, you could not execute the program. When you compile a program the compiler looks for syntax mistakes o.s. and if he finds someones, he aborts the compilation so that you dont gain an .exe file. Furthermore, during runtime, the compiler does nothing. So, if you want to have the program abort when you enter e.g. "senseless" for your language setting, you could write the following:
jetkeynature, that is wrong. You can use static_if statements as well as some other metaprogramming techniques. You need to do the research yourself though, most C++ programmers simply don't know much about it because it's a complicated matter.
IQChange - write a chapter of a book that I showed to you - it has a ready solution that will work... hopefully :P(because Alexandrescu's programs require latest C++ functionality, not every compiler has it; try to use it, and hopefully you will get what you want).