Topic: Requirements for classes underlying templates


Author: bkline@cortex.nlm.nih.gov (Bob Kline)
Date: 1996/08/15
Raw View
I have several classes from which I'm trying to build list<>'s, and
things were going along smoothly while we were using the GNU C++
compiler, but when we switched to IBM C Set++ 3.1 I started getting
errors complaining that the underlying classes did not have all the
operators required for the list template (I'm using my own
implementation of the parts of the draft standard library that
I need, as IBM doesn't seem to have string or any of the
container classes yet).  For example, if I have a class X with
no operator == I get a diagnostic that says "call does not match any
argument list for ::operator==; this message applies to the definition
of template list<X>::merge()."  However, nowhere in any module is a
call made, directly or indirectly, to list<X>::merge().

In 14.3.2.6 of the September 1995 working paper I read:

"An implementation shall not instantiate a function, nonvirtual member
function, class or member class that does not require instantiation.
It is unspecified whether or not an implementation instantiates a
virtual member function that does not require instantiation."

If I add all the "missing" operators to the underlying classes for the
list<> templates, the compiler is happy again, but it seems as if I
shouldn't have to do this.  Or am I just reading into the passage
above what I want to find?  Or is this a recent change to the emerging
specification of the language (though I see similar language in
earlier drafts)?  (Neither list<>::merge() nor any of the other
member functions involved are virtual member functions.)

(Also, does anyone have any inside information on when IBM's compiler
will get the standard string and container classes?)

TIA.

Bob Kline
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]