c++ multiple function on template? -
new c++ - kind of been cramming last few days. things going pretty well! have 1 question though.
if make template:
template <class t> t testfunc(t t1, t t2) { // code code code code }
my question, template <> line specific 1 function underneath? couldn't continue use t placeholder in further functions i? like:
template <class t> t testfunc(t t1, t t2) { // code code code code } t testfunc2(t t1, t t2) { // 1 other things....; }
well when declare
template <class t> t testfunc(t t1, t t2)
this means declaring generic function "testfunc" takes class , works it. honest, don't know how can useful. if defining function in global namespace can use many template 's above functions like. in way connected.
you can make generic class takes class template. way don't have write "template " above every single method in class. methods can take type t argument.
Comments
Post a Comment