Is it possible to do so
# define abc<T1> __abc<T1, T2>
template<typename T2> void somefun() {
...
abc<int>(...);
abc<double>(...);
...
}
Just to not write it every time i call abc
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In C++11 you can do:
Without that you can use a macro but you’d need to do:
but since that doesn’t look very natural I’d avoid it personally.
If you want to avoid the macro pre-C++11 you can do something like:
But in all honesty that’s less readable than even the macro case
(Note:
__abcis reserved)