
On Tue, Jun 2, 2009 at 2:31 AM, Ryan McConnehey
Scott McMurray wrote:
They're at least simple, but it's still a violation of DRY, so I'm not a big fan.
If a non-expanding interface is needed (non-template so that every type isn't accepted) does it really violate DRY?
What are the types really, anyways?
I've create true_typedef of the basic type like uint16, uint32, int16, etc. I've written my own serialization interface (I know boost already has one) and I'm restricting the interface to only allow certain types. I'm trying to centralize the were the real work happens so if new types are needed then added them won't be difficult.
Is there any reason you have to have different names for the map? Use
template specialization to achieve the same thing as name resolution for you
but still allowing you to access the maps through a consistent naming
scheme.
//The default specialization will cause compilation to fail unless
DECL_SERIALIZATION_SUPPORT(T) has been called for a type
#define BEGIN_SERIALIZATION_DECLS() \
namespace serialization { \
template<typename T> struct kv_map { }; \
#define DECL_SERIALIZATION_SUPPORT(T) \
template<> \
struct kv_map<T> \
{ \
typedef std::map