On 08/08/2015 10:09 PM, Lei Qiao wrote:
>
> Now I have to template argument need to go through in a test.cc file.
> But I don't want to write the code repeatedly or generate code by a script and
> paste a very long piece of boring code into the test.cc file.
You can do
template <typename T> void check () {
...code that uses type T...
}
int main () {
check<A>();
check<B>();
}
This way you only have to repeat the calls to check() for the template types A
and B, not the actual code.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@math.tamu.edu
www:
http://www.math.tamu.edu/~bangerth/