From 32b563205d44673c00e31efb06161574988d396e Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Thu, 29 Jan 2015 21:49:35 +0530 Subject: [PATCH 1/3] Expreesively says that Cipher doesn't copy or move. In c++14 we don't need to make copy ctor and copy assignment private. We can express that directly deleting the corresponding members. --- Crypto/include/Poco/Crypto/Cipher.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Crypto/include/Poco/Crypto/Cipher.h b/Crypto/include/Poco/Crypto/Cipher.h index 30d17f3cd0..710ac94eb9 100644 --- a/Crypto/include/Poco/Crypto/Cipher.h +++ b/Crypto/include/Poco/Crypto/Cipher.h @@ -99,7 +99,10 @@ class Crypto_API Cipher: public Poco::RefCountedObject ENC_BINHEX_NO_LF = 0x82, /// BinHex-encoded output, no linefeeds }; - + + Cipher(Cipher&&) = delete; + /// Expreesively says that Cipher doesn't copy or move. + virtual ~Cipher(); /// Destroys the Cipher. @@ -128,9 +131,6 @@ class Crypto_API Cipher: public Poco::RefCountedObject Cipher(); /// Creates a new Cipher object. -private: - Cipher(const Cipher&); - Cipher& operator = (const Cipher&); }; From 2fb76e4ff6df149c0ae0bc908a7ff45b965df5e7 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Thu, 29 Jan 2015 21:54:19 +0530 Subject: [PATCH 2/3] defaults work defaulted definition of default ctor and destructor works well. Then why should we intervene. --- Crypto/src/Cipher.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Crypto/src/Cipher.cpp b/Crypto/src/Cipher.cpp index 55ebff7568..e3dd79ed36 100644 --- a/Crypto/src/Cipher.cpp +++ b/Crypto/src/Cipher.cpp @@ -31,14 +31,10 @@ namespace Poco { namespace Crypto { -Cipher::Cipher() -{ -} +Cipher::Cipher() = default; -Cipher::~Cipher() -{ -} +Cipher::~Cipher() = default; std::string Cipher::encryptString(const std::string& str, Encoding encoding) From c254158e367643dd2e2818e6d2fed0aa547a9884 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Mon, 9 Feb 2015 10:52:52 +0530 Subject: [PATCH 3/3] Compiler seems better here Compiler might generate better =defaulted definition of default ctor and class dtor. --- Foundation/src/ASCIIEncoding.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Foundation/src/ASCIIEncoding.cpp b/Foundation/src/ASCIIEncoding.cpp index 01de073ab5..124572dda6 100644 --- a/Foundation/src/ASCIIEncoding.cpp +++ b/Foundation/src/ASCIIEncoding.cpp @@ -49,14 +49,10 @@ const TextEncoding::CharacterMap ASCIIEncoding::_charMap = }; -ASCIIEncoding::ASCIIEncoding() -{ -} +ASCIIEncoding::ASCIIEncoding() = default; -ASCIIEncoding::~ASCIIEncoding() -{ -} +ASCIIEncoding::~ASCIIEncoding() = default; const char* ASCIIEncoding::canonicalName() const