Advertisement

Not so generic template...

Started by November 09, 2000 03:17 AM
0 comments, last by karmalaa 24 years, 2 months ago
I'd like to develop a C++ template where the (so called) "istantiation class(es)" needs to be (at least) sub-type of another type. That is (for example):
    
    template <class S> class Array {
       // Blah, blah, blah...

    };
  
where S is sub-type of a given type T . How could I do this (without creating an over-complicated code)? Thanks in advance. Karmalaa Edited by - karmalaa on 11/9/00 3:22:52 AM
---[home page] [[email=karmalaa@inwind.it]e-mail[/email]]
by sub-type you mean derived class?

you just do it, as far as I can tell the only way to make it obvious is to use a descriptive name for the template parameter (instead of "T")
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement