piped::adl_map_to
<piped/map.hpp>
template<typename From undefined, typename To undefined>
struct piped::adl_map_to;
This is used to customize type conversion.
By default, this is a simple static_cast<To>(From)
. Generally you should not even have to customize this: simply implement the appropriate operators.
Sometimes you may want specific behavior to convert between values, perhaps for types you do not control in code you don't own or can't modify. In that case, a specific implementation may be useful.
struct myvec2 { float x, y; };
template<>
struct adl_map_to<myvec2, glm::vec2> {
static inline glm::vec2 convert(const myvec2& v) {
return {v.x, v.y};
}
};
Name | Description |
---|---|
convert(const From &v) |
Members
convert(const From &v)
<piped/map.hpp>
static To piped::adl_map_to< From, To >::convert(const From &v)
Description
Parameter | ||
---|---|---|
v | const From & |