blob: 54b04f34f79bdc5171bf7a3c64d30e7f337e5546 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#include "testutilities.h"
#include <iostream>
#include <sigc++/signal.h>
struct MoveableStruct
{
};
namespace
{
TestUtilities* util = nullptr;
std::ostringstream result_stream;
struct foo
{
void operator()(MoveableStruct&& /* x */) { result_stream << "foo(MoveableStruct&&)"; }
};
} // end anonymous namespace
void
test_signal()
{
sigc::signal<void(MoveableStruct &&)> signal;
foo f;
signal.connect(f);
MoveableStruct x;
signal(std::move(x));
util->check_result(result_stream, "foo(MoveableStruct&&)");
}
void
test_slot()
{
sigc::slot<void(MoveableStruct &&)> slot;
foo f;
slot = f;
MoveableStruct x;
slot(std::move(x));
util->check_result(result_stream, "foo(MoveableStruct&&)");
}
int
main(int argc, char* argv[])
{
util = TestUtilities::get_instance();
if (!util->check_command_args(argc, argv))
return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE;
test_signal();
test_slot();
return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE;
} // end main()
|