From: Nat Goodspeed (nat_at_[hidden])
Date: 2008-04-02 10:54:11


Steven Watanabe wrote:
>
> I was just thinking of moving the duplicated code into CRTPPacket
>
> template<class Derived, PacketID Id>
> struct CRTPPacket : Packet {
> static const PacketID ID = Id;
> virtual PacketID getID() const { return(ID); }
> };

Does it even need to be CRTP?

template<PacketID Id>
struct IDPacket : Packet {
     static const PacketID ID = Id;
     virtual PacketID getID() const { return(ID); }
};

Perhaps we're assuming other methods that would make use of Derived.