map and virtual operator< for base class

Bernd Prager bernd@prager.ws
Tue May 11 00:29:00 GMT 2010


Thanks John,

So the only way basically is then to have a separate map for each class, 
right?
Is there a better way to implement a class cache for multiple class types?

-- Bernd

On 5/10/2010 7:36 PM, John Fine wrote:
> I believe the second definition masks the first, rather than 
> overriding the first, because the input is different:
> const Base&
> vs.
> const Tst&
>
> Bernd Prager wrote:
>>
>> class Base {
>> public:
>> virtual bool operator<(const Base& b) const;
>> ...};
>>
>> ...
>>
>> class Tst: public Base {
>> public:
>> bool operator<(const Tst& t) const; // less then
>>



More information about the Gcc-help mailing list