Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Samples for...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 9523 of 10094
Post > Topic >>

Re: Samples for non-type template argument other than integral types

by Lance Diduck <lancediduck@[EMAIL PROTECTED] > Apr 20, 2008 at 09:02 PM

> 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! ]
 




 2 Posts in Topic:
Samples for non-type template argument other than integral types
Marco Dorantes <marcod  2008-04-20 15:49:32 
Re: Samples for non-type template argument other than integral t
Lance Diduck <lancedid  2008-04-20 21:02:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 18:31:33 CDT 2008.