From ad5e0614d446dabd5b409c72b3209fcd3239d587 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Fri, 19 Sep 2014 08:55:23 -0300 Subject: [PATCH] Added constructors to RawPDU. --- include/rawpdu.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/rawpdu.h b/include/rawpdu.h index 99a116c..3404b64 100644 --- a/include/rawpdu.h +++ b/include/rawpdu.h @@ -33,6 +33,7 @@ #include #include #include "pdu.h" +#include "cxxstd.h" namespace Tins { @@ -81,6 +82,31 @@ namespace Tins { */ RawPDU(const uint8_t *pload, uint32_t size); + /** + * \brief Constructs a RawPDU from an iterator range. + * + * The data in the iterator range is copied into the RawPDU + * internal buffer. + * + * \param start The beginning of the iterator range. + * \param end The end of the iterator range. + */ + template + RawPDU(ForwardIterator start, ForwardIterator end) + : _payload(start, end) { } + + #if TINS_IS_CXX11 + /** + * \brief Creates an instance of RawPDU from a payload_type. + * + * The payload is moved into the RawPDU's internal buffer. + * + * \param data The payload to use. + */ + RawPDU(payload_type&& data) + : _payload(move(data)) { } + #endif // TINS_IS_CXX11 + /** * \brief Creates an instance of RawPDU from an input string. *