Newsgroups: comp.lang.c++ Path: utzoo!utgpu!cunews!csi.uottawa.ca!news From: hitz@csi.uottawa.ca (Martin Hitz) Subject: Re: Common data structures Message-ID: <1991Jun19.163007.18398@csi.uottawa.ca> Sender: news@csi.uottawa.ca Nntp-Posting-Host: sim5 Organization: University of Ottawa References: Date: Wed, 19 Jun 91 16:30:07 GMT In article tmb@ai.mit.edu (Thomas M. Breuel) writes: >The problem is that C++'s version of polymorphism is rather inconvenient >to use. > >In C++, you must introduce type names in templates and specify them at >the point of use even if the compiler has enough information to infer >this information (I don't have a C++ compiler with templates, so the >syntax that your C++ implementation uses for templates may differ >slightly from what I am using in this example): > > template list map(base (*f)(base),list l) ... ; > ... > map(f,l); > According to the ARM, the example should read: template list map(base (*f)(base),list l); float f (float); list l; ... map(f,l); Note that at the call to map(), the compiler DOES infer the correct type. Martin Hitz@csi.uottawa.ca