Declare single-argument (non-converting) constructors "explicit"

In order to avoid unintended implicit conversions.
This commit is contained in:
practicalswift
2017-08-01 12:22:41 +02:00
parent 22e301a3d5
commit 64fb0ac016
68 changed files with 105 additions and 105 deletions

View File

@@ -402,7 +402,7 @@ class CVarInt
protected:
I &n;
public:
CVarInt(I& nIn) : n(nIn) { }
explicit CVarInt(I& nIn) : n(nIn) { }
template<typename Stream>
void Serialize(Stream &s) const {
@@ -420,7 +420,7 @@ class CCompactSize
protected:
uint64_t &n;
public:
CCompactSize(uint64_t& nIn) : n(nIn) { }
explicit CCompactSize(uint64_t& nIn) : n(nIn) { }
template<typename Stream>
void Serialize(Stream &s) const {
@@ -439,7 +439,7 @@ class LimitedString
protected:
std::string& string;
public:
LimitedString(std::string& _string) : string(_string) {}
explicit LimitedString(std::string& _string) : string(_string) {}
template<typename Stream>
void Unserialize(Stream& s)