Let\'s say I have a function:
template
inline void doSomething() {
if(stuff) {
cout << \"Hello\" << endl;
}
el
This is inherently up to the compiler, so you'd have to check the compiler's documentation or the generated code. But in simple cases like this, you can easily implement the optimization yourself:
template
inline void doSomething();
template<>
inline void doSomething() {
cout << "Hello" << endl;
}
template<>
inline void doSomething() {
cout << "Goodbye" << endl;
}
But "optimization" isn't really the right word to use since this might actually degrade performance. It's only an optimization if it actually benefits your code performance.