template <typename T, typename U>
struct TypeConverter
Specialize the following class:
template
<typename
T, typename U> struct TypeConverter;
to perform desired type conversions. Here, T is the target type; U is the
input type.
To convert from type Y to type X, create a specialization of TypeConverter
like this:
namespace fidl {
template
<
>
struct TypeConverter
<X
, Y> {
static X Convert(const Y
&
input);
};
} // namespace fidl
With this specialization, it's possible to write code like this:
Y y;
X x = fidl::To
<X
>(y);