c++ - template in cpp -
i hav following piece of code in module.
controller name of class. allocate_route member function of it.
while defining member function given as
template<ui num_ip> void controller<num_ip>::allocate_route() { }
ui unsigned integer. num_ip
not defined where. has not used num_ip
anywhere inside code. tell compiler statement. not able comprehend use of templates here. wat code do?
that code implements function allocate_route
defined in template class controller
.
when creating template classes, have 2 way implement functions:
template <int a> class { void x() { ... } };
or
template <int a> class { void x(); }; template <int a> void a<a>::x() { }
Comments
Post a Comment