From patchwork Fri Jan 18 16:07:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [esnacc-dev] cxx/asnbufbits: constify operator< X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 40 X-Patchwork-Delegate: aconole@bytheb.org Message-Id: <20190118160712.3690-1-aconole@bytheb.org> To: dev@mail.esnacc.org Date: Fri, 18 Jan 2019 11:07:12 -0500 From: Aaron Conole List-Id: eSNACC Development discussion The less-than comparison operator makes no modifications to the internal state of either the lhs or rhs of the expression. Signal this properly as a 'const' operation. Signed-off-by: Aaron Conole --- cxx-lib/inc/asn-buf.h | 2 +- cxx-lib/src/asn-bufbits.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cxx-lib/inc/asn-buf.h b/cxx-lib/inc/asn-buf.h index 013e3d6..c2e7bd3 100644 --- a/cxx-lib/inc/asn-buf.h +++ b/cxx-lib/inc/asn-buf.h @@ -216,7 +216,7 @@ public: } */ - bool operator<(AsnBufBits &rhs); + bool operator<(const AsnBufBits &rhs) const; unsigned char MaskBits(unsigned char cCharToMask, int iBitsToMask); unsigned long PutBits(const unsigned char* seg, unsigned long numBits); diff --git a/cxx-lib/src/asn-bufbits.cpp b/cxx-lib/src/asn-bufbits.cpp index 361d172..368f65c 100644 --- a/cxx-lib/src/asn-bufbits.cpp +++ b/cxx-lib/src/asn-bufbits.cpp @@ -627,7 +627,7 @@ unsigned char AsnBufBits::MaskBits(unsigned char cCharToMask, int iBitsToMask) //RWC;TBD; FIX THIS TO WORK PROPERLY..... -bool AsnBufBits::operator<(AsnBufBits &rhs) +bool AsnBufBits::operator<(const AsnBufBits &rhs) const { FUNC("AsnBufBits::operator<()");