Skip to content

Commit 414d9f4

Browse files
committed
tests: Make single argument constructors explicit.
Found by the google-explicit-constructor clang-tidy check.
1 parent 259f20b commit 414d9f4

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

tests/test_bind.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ egon(std::string& str)
6868

6969
struct book : public sigc::trackable
7070
{
71-
book(const std::string& name) : name_(name) {}
71+
explicit book(const std::string& name) : name_(name) {}
7272

7373
// non-copyable:
7474
book(const book&) = delete;

tests/test_bind_ref.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ std::ostringstream result_stream;
1616
class Param : public sigc::trackable
1717
{
1818
public:
19-
Param(const std::string& name) : name_(name) {}
19+
explicit Param(const std::string& name) : name_(name) {}
2020

2121
// non-copyable,
2222
// so it can only be used with sigc::bind() via sigc::ref()

tests/test_bind_refptr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class RefPtr
8686
* Increments the reference count.
8787
*/
8888
template <typename T_CastFrom>
89-
inline RefPtr(const RefPtr<T_CastFrom>& src);
89+
inline explicit RefPtr(const RefPtr<T_CastFrom>& src);
9090

9191
/** Swap the contents of two RefPtr<>.
9292
* This method swaps the internal pointers to T_CppObject. This can be

tests/test_bind_return.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct foo
2727

2828
struct bar : public sigc::trackable
2929
{
30-
bar(int i = 0) : i_(i) {}
30+
explicit bar(int i = 0) : i_(i) {}
3131
operator int() { return i_; }
3232
int i_;
3333
};

tests/test_track_obj.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Functor1
6262
public:
6363
using result_type = std::string;
6464

65-
Functor1(const bar_group4& bar) : bar_(bar) {}
65+
explicit Functor1(const bar_group4& bar) : bar_(bar) {}
6666

6767
std::string operator()(int i) { return (i < 0) ? "negative" : ((i > 0) ? "positive" : "zero"); }
6868

tests/test_visit_each.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace
5959
class MyClass1 : public sigc::trackable
6060
{
6161
public:
62-
MyClass1(const std::string& str) : s(str) {}
62+
explicit MyClass1(const std::string& str) : s(str) {}
6363

6464
void execute(int i) { result_stream << s << i; }
6565
private:
@@ -69,7 +69,7 @@ class MyClass1 : public sigc::trackable
6969
class MyClass2 : public ns_ext::NsExtClass, public sigc::trackable
7070
{
7171
public:
72-
MyClass2(const std::string& str) : s(str) {}
72+
explicit MyClass2(const std::string& str) : s(str) {}
7373

7474
void execute(int i) { result_stream << s << i; }
7575
private:

0 commit comments

Comments
 (0)