C++ template comprehension -



C++ template comprehension -

i trying understand meaning of next code since valid c++ code:

template<class a> class @ { at(); }; template<class b> at<b>::at() {}

can help me understand effect of template instantiation in constructor? , if can come useful practical utilize case appreciate.

tanks

there no template instantiation here. later half of code defines constructor at class. note general practice utilize same names template parameters when doing this:

template<class a> class @ { at(); }; template<class a> at<a>::at() {}

the utilize syntax break dependency loops:

template<class a> class @ { at(); }; class dependent { at<dependant> member; // finish definition of @ needed here }; template<class a> at<a>::at() { dependent object; // finish definition of dependent needed here }

c++ templates semantics

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -