c++ - Using Function Templates -
I have created a structure of various data types and I want to return all types of data. Can such a function be done using templates, which takes different data arguments that are not included in the structure or any arguments?
I have something like that,
struct mystruct {int _int; Four _c; String _state}; In the function template (int i) {mystruct s; Switch (getInput) {case 1: return s._int; Case 2: Returns s._c; Case 3: Return s._str; }} Zero main () {int getInput = 1; // pass getInput value to work on template}
Yes:
template & lt; Class T & gt; TF () {Return 0; // for example}}}} {main}} {returning; At & G; (); // template parameter} template & lt; Class T & gt; Please, specify. Of vector & lt; T & gt; another example(); // Use another_language & lt; Int & gt; () Which is a vector & lt; Int & gt;
Comments
Post a Comment