Bloomberg LP Interview Question
Software Engineer / DevelopersThe compiler will catch errors which do not depend on template parameters. For example the following will result in a compiler error.
template<typename T>
class Foo {
Foo(T t) t_(t) { t.baz(); } //baz may not exist, but the compiler does not know that till instantiation
void bar() //Notice the
T t_;
};
int main() {
return 1;
}
ahh, I misunderstood the question... Jasmeet is right. non template parameter syntax errors are issues. (aka missing semi colon), it should also be noted that these are also only issues if the template is included somewhere.. aka, if template is in a header that is not "included" (#include...) anywhere, it will not complain. (though that might be a given)
not until template is used
- NewStart April 21, 2010