have a Encoder class which is used to encode (Document, Tileset, Tile, Grid etc) inside of it. For now Encoder class is abstract but I still need to support many formats (i.e. JsonEncoder) and there I want to implement the whole logic of how would I encode said object (Document, Tile, Grid etc) inside of it. How'd I achieve that without templates? I'd like to be able to call Encoder().encode<Tileset>(&tileset) but apparently I'll have to give away beauty for success
I try to avoid templates as much as I can, here is my approach, add a pure virtual method encode() and then inherit that Encoder class into something like Document and define the method there, that way, that it will be like tileset.encode(), to get itself encoded
Обсуждают сегодня