-
Notifications
You must be signed in to change notification settings - Fork 0
API muesli fluent constructable
Defined in header <muesli/fluent/constructable>
template<ValueType>
struct apply_codecForward declaration of apply_codec
Creates an apply_codec targeting the specified type
Wraps this codec with type transformation to encode/decode a different target type. The apply_codec will call user-provided constructor functions or use default construction when transitioning between types.
template<typename ValueType> constexpr auto apply() const noexceptReturns: An apply_codec that constructs ValueType from this codec
Example:
struct Point { double x, y; };
auto coords = tuple_codec(double_codec, double_codec);
auto point_codec = coords.apply<Point>();template<Derived>
struct constructableMixin providing .apply() to construct values of type T
This mixin provides the .apply() method which wraps the current codec in an apply_codec to encode/decode a different type than the codec's native value_type. Useful for adapting codecs to custom types.
Creates an apply_codec targeting the specified type
Wraps this codec with type transformation to encode/decode a different target type. The apply_codec will call user-provided constructor functions or use default construction when transitioning between types.
template<typename ValueType> constexpr auto apply() const noexceptReturns: An apply_codec that constructs ValueType from this codec
Example:
struct Point { double x, y; };
auto coords = tuple_codec(double_codec, double_codec);
auto point_codec = coords.apply<Point>();- Related codecs:
apply_codec
template<typename ValueType> constexpr auto apply() const noexceptCreates an apply_codec targeting the specified type
Wraps this codec with type transformation to encode/decode a different target type. The apply_codec will call user-provided constructor functions or use default construction when transitioning between types.
| Parameter | Description |
|---|---|
ValueType |
The target type to encode/decode |
Returns: An apply_codec that constructs ValueType from this codec
struct Point { double x, y; };
auto coords = tuple_codec(double_codec, double_codec);
auto point_codec = coords.apply<Point>();