home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!munnari.oz.au!sol.deakin.OZ.AU!news.cs.uow.edu.au!cssc-syd.tansu.com.au!pete
- From: pete@cssc-syd.tansu.com.au (Peter Alexander Merel)
- Subject: Re: Templates parameterized on templates (!)
- Message-ID: <1992Nov24.030358.26152@cssc-syd.tansu.com.au>
- Organization: AOTC - CSSC
- References: <1992Nov19.215956.20239@cssc-syd.tansu.com.au> <1992Nov21.180344.101927@Cookie.secapl.com>
- Date: Tue, 24 Nov 1992 03:03:58 GMT
- Lines: 47
-
- frank@Cookie.secapl.com (Frank Adams) writes:
- >pete@cssc-syd.tansu.com.au (Peter Alexander Merel) writes:
- >>template<template Container, class T>
- >>class troppo
- >>:
- >> public Container<T>
- >>{
- >> ...
- >>};
- >>
- >I'm not up on whether real live 3.0 compilers will do this
-
- >They don't, and I think they should, too. But the first line should
- >probably be either:
- >
- >template<template<class> Container, class T>
- >or
- >template<template Container<class>, class T>
-
- You're right - there's not much checking the compiler can do at the template
- level, but at least it can see that we've got the right number of arguments.
-
- >In the mean time, you can write:
- >template<class Container, class T>
- >
- >with the assertion that the template will only work if Container is a
- >container class whose element type is T.
-
- I'm after something more powerful than this. The containers in the OSE class
- library all have different interfaces - there are maps, sets, lists, and all
- manner of whatnot, all (well, most, but for my purposes all) based on a
- class that will return an iterator and do a number of useful common services.
-
- I want to make available this variety of templated containers from within a
- value-added template of mine. If templates cannot be parameterised on
- templates, then I am forced to write a dozen or so templates to do this, one
- for each templated container type.
-
- If templates could be parameterised on other templates then I could accomplish
- this with just a single template, and of course this template would be
- extensible as OSE evolves ... which sounds like the finest kind of interface
- to me.
-
- --
- Internet: pete@cssc-syd.tansu.com.au UUCP: {uunet,mcvax}!munnari!cssc-syd!pete
- Snail: 1/18-20 Orion Road, Lane Cove NSW 2066 Australia Phone: +61 2 911 3130
- I am a big pond in a small fish.
-