> I am interested to discuss how others have used these other types of
> non-type template arguments. Could you please point to typical uses
> of?:
>
> 1- the address of an object
> 2- the address of a function with external linkage,
> 3- a non-overloaded pointer to member
>
> Thank you very much in advance for any comment.
Example 1: Address of an object is used often when interfacing with
legacy static data structures , which are often found in very old C
and FORTRAN code.
Example 2 is the STL, anywhere that is uses a comparator function or
deleter function -- these can be functions with external linkage.
Example 3: Again, the STL uses this in mem_ptr and mem_ptr_ref
And excellent book to help you explore further is "C++ Templates" by
Vandevoorde et al , "C++ template metaprogramming" by Abrahams et al
on the various template tricks, and "Generic Programming with the STL"
by Austern and "Modern C++ Design" by Alexandrescu on what you can do
with same.
There is heavy interest in doing functional programming using C++
templates, this looks like something you would be interested in. The
lambda library has just become part of the draft standard, and there
is enough template trickery in there to keep you challenged for
years!!
Lance
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|