Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-03-29 16:40:09


AMDG

Robert Dailey wrote:
> It seems that so far we've gotten everything done without RTTI, I
> would hate to introduce it here.

RTTI is not always evil. It may be less efficient to hash the strings,
but it is not worse from a design perspective.

> I see what you're saying now. Something like this might be in order:
>
> struct Packet
> {
> virtual PacketId GetId() const = 0;
> };
>
> struct WalkPacket : Packet
> {
> static const PacketId ID = PID_WALKPACKET;
> virtual PacketId GetId() const { return ID; }
> };

Yep. That works. Just thought I'd point out that this is not so very
different
from RTTI, after all.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net