Is it wise to have include guards around template classes?
Aren’t template classes supposed to be reparsed each time you reference them with a different implementation?
N.B In Visual C++ 2008 I get no errors combining the two…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Templates definitions are supposed to be parsed once (and things like two phases name lookup are here so that as much errors as possible can be given immediately without having an instantiation). Instantiations are done using the internal data structure built at that time.
Templates definitions are usually (i.e. if you aren’t using
exportor doing something special) in header files which should have their include guard. Adding one for template definition is useless but not harmful.