diff options
author | JINMEI Tatuya <jinmei@isc.org> | 2013-03-06 05:10:39 +0100 |
---|---|---|
committer | JINMEI Tatuya <jinmei@isc.org> | 2013-03-06 05:10:39 +0100 |
commit | 6c4f943e65aad695443076065082d40cfddbfe83 (patch) | |
tree | 9aec78c3f66c6317c4b28a9a24bd209b0eecca51 /src/lib/util/encode/base_n.cc | |
parent | [master] Update changelog for merge of 2713 (diff) | |
download | kea-6c4f943e65aad695443076065082d40cfddbfe83.tar.xz kea-6c4f943e65aad695443076065082d40cfddbfe83.zip |
[2764] implement postfix version of EncodeNormalizer::operator++.
transform_width in Boost 1.53 requires this version, so build will fail
without it.
Diffstat (limited to 'src/lib/util/encode/base_n.cc')
-rw-r--r-- | src/lib/util/encode/base_n.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/lib/util/encode/base_n.cc b/src/lib/util/encode/base_n.cc index c38f9017e9..3ea4486190 100644 --- a/src/lib/util/encode/base_n.cc +++ b/src/lib/util/encode/base_n.cc @@ -110,15 +110,15 @@ public: const vector<uint8_t>::const_iterator& base_end) : base_(base), base_end_(base_end), in_pad_(false) {} - EncodeNormalizer& operator++() { - if (!in_pad_) { - ++base_; - } - if (base_ == base_end_) { - in_pad_ = true; - } + EncodeNormalizer& operator++() { // prefix version + increment(); return (*this); } + EncodeNormalizer operator++(int) { // postfix version + const EncodeNormalizer copy = *this; + increment(); + return (copy); + } const uint8_t& operator*() const { if (in_pad_) { return (BINARY_ZERO_CODE); @@ -130,6 +130,14 @@ public: return (base_ == other.base_); } private: + void increment() { + if (!in_pad_) { + ++base_; + } + if (base_ == base_end_) { + in_pad_ = true; + } + } vector<uint8_t>::const_iterator base_; const vector<uint8_t>::const_iterator base_end_; bool in_pad_; |