Ray's playground

 

C++ templates chapter 2(Function Templates)

Templates are compiled twice:
  1. Without instantiation, the template code itself is checked for correct syntax. Syntax errors are discovered, such as missing semicolons.

  2. At the time of instantiation, the template code is checked to ensure that all calls are valid. Invalid calls are discovered, such as unsupported function calls.

Automatic type conversion is not considered for templates but is considered for ordinary functions.

max.hpp

 

max.cpp

 

posted on 2009-09-18 16:11  Ray Z  阅读(207)  评论(0编辑  收藏  举报

导航