From f330c0eca8fa51a47b657ffdb92752f78ff9e9f7 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 3 Jun 2019 23:17:15 -0400 Subject: [PATCH] Clear warning on missing assignment operator --- modarith.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/modarith.h b/modarith.h index a00582eb..e21ba677 100644 --- a/modarith.h +++ b/modarith.h @@ -26,15 +26,17 @@ CRYPTOPP_DLL_TEMPLATE_CLASS AbstractRing; CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain; /// \brief Ring of congruence classes modulo n -/// \details This implementation represents each congruence class as the smallest -/// non-negative integer in that class. -/// \details const Element& returned by member functions are references -/// to internal data members. Since each object may have only -/// one such data member for holding results, the following code -/// will produce incorrect results: -///
    abcd = group.Add(group.Add(a,b), group.Add(c,d));
-/// But this should be fine: -///
    abcd = group.Add(a, group.Add(b, group.Add(c,d));
+/// \details This implementation represents each congruence class as +/// the smallest non-negative integer in that class. +/// \details const Element& returned by member functions are +/// references to internal data members. Since each object may have +/// only one such data member for holding results, you should use the +/// class like this: +///
    abcd = group.Add(a, group.Add(b, group.Add(c,d));
+/// The following code will produce incorrect results: +///
    abcd = group.Add(group.Add(a,b), group.Add(c,d));
+/// \sa Integer on the +/// Crypto++ wiki. class CRYPTOPP_DLL ModularArithmetic : public AbstractRing { public: @@ -239,7 +241,7 @@ public: /// \details RandomElement constructs a new element in the range [0,n-1], inclusive. /// The element's class must provide a constructor with the signature Element(RandomNumberGenerator rng, /// Element min, Element max). - Element RandomElement(RandomNumberGenerator &rng , const RandomizationParameter &ignore_for_now = 0) const + Element RandomElement(RandomNumberGenerator &rng, const RandomizationParameter &ignore_for_now = 0) const // left RandomizationParameter arg as ref in case RandomizationParameter becomes a more complicated struct { CRYPTOPP_UNUSED(ignore_for_now); @@ -253,7 +255,11 @@ public: bool operator==(const ModularArithmetic &rhs) const {return m_modulus == rhs.m_modulus;} - static const RandomizationParameter DefaultRandomizationParameter ; + static const RandomizationParameter DefaultRandomizationParameter; + +private: + // Squash warning on missing assignment operator. + ModularArithmetic& operator=(const ModularArithmetic &ma); protected: Integer m_modulus;