diff --git a/include/envelope.h b/include/envelope.h index c793eab..f66331f 100644 --- a/include/envelope.h +++ b/include/envelope.h @@ -18,6 +18,12 @@ namespace AMQP { class Envelope : public MetaData { protected: + /** + * The body (only used when string object was passed to constructor + * @var std::string + */ + std::string _str; + /** * Pointer to the body data (the memory buffer is not managed by the AMQP * library!) @@ -47,7 +53,7 @@ public: * Constructor based on a string * @param body */ - Envelope(const std::string &body) : MetaData(), _body(body.data()), _bodySize(body.size()) {} + Envelope(const std::string &body) : MetaData(), _str(body), _body(_str.data()), _bodySize(_str.size()) {} /** * Destructor