...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A Body type is supplied as a template argument
to the message
class. It controls both
the type of the data member of the resulting message object, and the algorithms
used during parsing and serialization.
In this table:
B
is a type meeting the
requirements of Body.
m
is a value of type
message<b,B,F>
where b
is a bool
value and F
is a type meeting the requirements of Fields.
Table 1.37. Valid expressions
Expression |
Type |
Semantics, Pre/Post-conditions |
---|---|---|
|
The return type of the |
|
|
If present, indicates that the body can be parsed. The type must meet the requirements of BodyReader. The implementation constructs an object of this type to obtain buffers into which parsed body octets are placed. |
|
|
If present, indicates that the body is serializable. The type must meet the requirements of BodyWriter. The implementation constructs an object of this type to obtain buffers representing the message body for serialization. |
|
B::size( B::value_type body) |
|
This static member function is optional. It returns the payload
size of When this function is present: * The function shall not fail
* A call to
* A call to Otherwise, when the function is omitted:
* A call to
* A call to |
struct Body { // The type of message::body when used struct value_type; /// The algorithm used during parsing class reader; /// The algorithm used during serialization class writer; /// Returns the body's payload size static std::uint64_t size(value_type const& body); }; static_assert(is_body<Body>::value, "");