[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: c++ question: code duplication across classes
From: Benoit Jacob <jacob () math ! jussieu ! fr>
Date: 2006-09-22 14:19:20
Message-ID: Pine.LNX.4.64.0609221611560.22325 () galois4 ! math ! jussieu ! fr
[Download RAW message or body]
So I am doing this CRTP thing, and I have a problem: is there a way that
I can put the operators like operator=, +=, -=, ... in the base class? Or
am I forced to implement them in each subclass?
When trying to put them in the base class, I'm running into problems as
C++ specifies that operator= doesn't get inherited by default. I read
something about the 'using' C++ keyword but that doesn't seem to be
compatible with templates.
So am I forced to put the operators in the subclasses? No way around that?
Benoit
> CRTP or global functions. I really like the CRTP (which stands for "Curiously
> Recurring Template Pattern btw), so I'll go with it. But if you're more
> confident with global functions, use them.
> --
> Sylvain
>
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic