[libsigc++2/variadic_bind2: 21/68] tests: Use = delete instead of private constructors.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigc++2/variadic_bind2: 21/68] tests: Use = delete instead of private constructors.
- Date: Tue, 1 Mar 2016 21:45:29 +0000 (UTC)
commit 322d84c68cb207a6c8ec4b2c7cf77c79076016d0
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jan 14 09:20:35 2016 +0100
tests: Use = delete instead of private constructors.
To make classes non-copyable.
tests/test_bind.cc | 13 +++++++++----
tests/test_bind_ref.cc | 14 +++++++++-----
tests/testutilities.h | 13 ++++++++++---
3 files changed, 28 insertions(+), 12 deletions(-)
---
diff --git a/tests/test_bind.cc b/tests/test_bind.cc
index 10840a0..3ab7cf6 100644
--- a/tests/test_bind.cc
+++ b/tests/test_bind.cc
@@ -71,15 +71,20 @@ void egon(std::string& str)
struct book : public sigc::trackable
{
book(const std::string& name) : name_(name) {}
+
+ //non-copyable:
+ book(const book&) = delete;
+ book& operator=(const book&) = delete;
+
+ //non movable:
+ book(book&&) = delete;
+ book& operator=(book&&) = delete;
+
std::string& get_name() { return name_; }
operator std::string& () { return get_name(); }
private:
std::string name_;
-
- //non-copyable:
- book(const book&);
- book& operator=(const book&);
};
} // end anonymous namespace
diff --git a/tests/test_bind_ref.cc b/tests/test_bind_ref.cc
index c30239e..d8ea53b 100644
--- a/tests/test_bind_ref.cc
+++ b/tests/test_bind_ref.cc
@@ -16,12 +16,16 @@ public:
: name_(name)
{}
- std::string name_;
+ //non-copyable,
+ //so it can only be used with sigc::bind() via sigc::ref()
+ Param(const Param&) = delete;
+ Param& operator=(const Param&) = delete;
+
+ //non movable:
+ Param(Param&&) = delete;
+ Param& operator=(Param&&) = delete;
-private:
- //non-copyable, so it can only be used with sigc::bind() via std::ref()
- Param(const Param&);
- Param& operator=(const Param&);
+ std::string name_;
};
void handler(Param& param)
diff --git a/tests/testutilities.h b/tests/testutilities.h
index bb7a9a7..f06d6d9 100644
--- a/tests/testutilities.h
+++ b/tests/testutilities.h
@@ -24,6 +24,15 @@
class TestUtilities
{
public:
+
+ // Non-copyable:
+ TestUtilities(const TestUtilities&) = delete;
+ TestUtilities& operator=(const TestUtilities&) = delete;
+
+ // Non-movable:
+ TestUtilities(TestUtilities&&) = delete;
+ TestUtilities& operator=(TestUtilities&&) = delete;
+
static TestUtilities* get_instance();
bool check_command_args(int argc, char* argv[]);
void check_result(std::ostringstream& result_stream, const std::string& expected_result);
@@ -35,9 +44,7 @@ public:
static bool get_result_and_delete_instance();
private:
- // Not copyable. These are not implemented.
- TestUtilities(const TestUtilities&);
- TestUtilities& operator=(const TestUtilities&);
+
TestUtilities();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]