Listing 1
namespace marshal { struct empty_type {}; template <typename T> struct traits // Value types { typedef typename boost::call_traits<T>::const_reference param_type; typedef T value_type ; enum { in = 1, out = 0, returnable = 1, indirect = 0 }; }; template <> struct traits< void > { typedef void param_type; typedef empty_type value_type ; enum { in = 0, out = 0, returnable = 1, indirect = 0 }; }; template <typename T> struct traits< out<T&> > // Out-only by reference { typedef out<T&> param_type; typedef T value_type ; enum { in = 0, out = 1, returnable = 0, indirect = 0 }; }; template <> struct traits< const char * > // C-style string, in-only { typedef const char * param_type; typedef c_string<char> value_type; // like std::string but preserves NULL static param_type to_arg(value_type & val) { val.m_std_string.c_str();} enum { in = 1, out = 0, returnable = 0, indirect = 0 }; };