August 2012
Intermediate to advanced
976 pages
30h 17m
English
It is worth noting that for the char* versions of debug_rep to work correctly, a declaration for debug_rep(const string&) must be in scope when these functions are defined. If not, the wrong version of debug_rep will be called:
template <typename T> string debug_rep(const T &t);template <typename T> string debug_rep(T *p);// the following declaration must be in scope// for the definition of debug_rep(char*) to do the right thingstring debug_rep(const string &);string debug_rep(char *p){ // if the declaration for the version that takes a const string& is not in scope // the return will call debug_rep(const T&) with T instantiated to string return debug_rep(string(p));}
Ordinarily, ...
Read now
Unlock full access