[Cs3] function pointers and templated functions
Mikhail Nesterenko
mikhail at cs.kent.edu
Mon Feb 26 10:33:10 EST 2024
CS3 students,
There was a question about function pointers and templated
functions. The answer is that a function pointer may not point to a
template. But it may point to an instance, the template must be
instantiated at the time of the function pointer declaration.
The fun part is that, at the time of the function pointer declaration,
the pointer type or the template instance may potential be deduced by
the compiler.
See the below example.
http://www.cs.kent.edu/~mikhail/classes/cs3/Examples/STLAlgorithms/Introduction/fp2templateInstance.cpp
Thanks,
--
Mikhail
More information about the cs3
mailing list