The trick behind this uses template and C++ overloads. So that every encoding works.
namespace detail
{
template <typename char_type= char>
const char_type* begin_fix();
template <>
inline const char* begin_fix<char>()
{
return "FIX.4.2";
}
template <>
inline const char16_t* begin_fix<char16_t>()
{
return u"FIX.4.2";
}
template <>
inline const char8_t* begin_fix<char8_t>()
{
return u8"FIX.4.2";
}
} // namespace detail
Amlal.