3 ms·
How does one use that template? Can you show me a function that takes anything with a do() method? Like this?: do<A>(a) do<B>(b) Can I take any arbitr
by Olreich 14y ago
How does one use that template? Can you show me a function that takes anything with a do() method? Like this?:
do<A>(a)
do<B>(b)
Can I take any arbitrary type with an "int do()" method and use that with do? Like:
do(Arbitrary)
- dan00 14y ago"How does one use that template? Can you show me a function that takes anything with a do() method? Like this?:" It should work without the template parameter: do(a), do(b) "Can I take any arbitrary type with an "int do()" method and use that with do?" Yes.
- Olreich 14y agocool
- masklinn 14y agoAs dan00 noted, it works without the template as long as there is no ambiguity. If there's an ambiguity (a template function defined on <int, int> and <double, double> to which you provide an int and a double) then you have to use explicit template parameter to specify which overload will be used. It's not the case here, so it just works.