Remove unnecessary const_cast

Now that an const T overload of xdr() has been added back, the cast is
no longer necessary.
Encode map entries using std::pair specialization

Now that const values can be encoded we can use the std::pair logic.