aboutsummaryrefslogtreecommitdiff
path: root/src/tinyformat.h
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2017-08-01 12:22:41 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2017-08-16 16:33:25 +0200
commit64fb0ac016c7fd01c60c39af60f6431bac57f9ee (patch)
tree8d8523dd68167f9a6299dd92cc9dd5e0fd162b23 /src/tinyformat.h
parent22e301a3d56dc9e6878380ee92c7d19ca43119d2 (diff)
downloadbitcoin-64fb0ac016c7fd01c60c39af60f6431bac57f9ee.tar.xz
Declare single-argument (non-converting) constructors "explicit"
In order to avoid unintended implicit conversions.
Diffstat (limited to 'src/tinyformat.h')
-rw-r--r--src/tinyformat.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tinyformat.h b/src/tinyformat.h
index 5022d46809..2e453e56bb 100644
--- a/src/tinyformat.h
+++ b/src/tinyformat.h
@@ -167,7 +167,7 @@ namespace tinyformat {
class format_error: public std::runtime_error
{
public:
- format_error(const std::string &what): std::runtime_error(what) {
+ explicit format_error(const std::string &what): std::runtime_error(what) {
}
};
@@ -498,7 +498,7 @@ class FormatArg
FormatArg() {}
template<typename T>
- FormatArg(const T& value)
+ explicit FormatArg(const T& value)
: m_value(static_cast<const void*>(&value)),
m_formatImpl(&formatImpl<T>),
m_toIntImpl(&toIntImpl<T>)
@@ -867,7 +867,7 @@ class FormatListN : public FormatList
public:
#ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES
template<typename... Args>
- FormatListN(const Args&... args)
+ explicit FormatListN(const Args&... args)
: FormatList(&m_formatterStore[0], N),
m_formatterStore { FormatArg(args)... }
{ static_assert(sizeof...(args) == N, "Number of args must be N"); }
@@ -876,7 +876,7 @@ class FormatListN : public FormatList
# define TINYFORMAT_MAKE_FORMATLIST_CONSTRUCTOR(n) \
\
template<TINYFORMAT_ARGTYPES(n)> \
- FormatListN(TINYFORMAT_VARARGS(n)) \
+ explicit FormatListN(TINYFORMAT_VARARGS(n)) \
: FormatList(&m_formatterStore[0], n) \
{ assert(n == N); init(0, TINYFORMAT_PASSARGS(n)); } \
\