5
5
#include " testutilities.h"
6
6
#include < sigc++/sigc++.h>
7
7
8
- // TODO: put something like #ifndef FORTE (some older version, I think) or AIX xlC... #else ...
9
- // #endif around:
10
- #define ENABLE_TEST_OF_OVERLOADED_FUNCTIONS 0
11
-
12
8
namespace
13
9
{
14
10
@@ -33,12 +29,10 @@ struct test
33
29
34
30
void foo_overloaded (char i1) { result_stream << " test::foo_overloaded(char " << int (i1) << ' )' ; }
35
31
36
- #if ENABLE_TEST_OF_OVERLOADED_FUNCTIONS
37
32
void foo_overloaded (short i1)
38
33
{
39
34
result_stream << " test::foo_overloaded(short " << (int )i1 << ' )' ;
40
35
}
41
- #endif
42
36
43
37
double foo_overloaded (int i1, int i2)
44
38
{
@@ -97,24 +91,22 @@ test_const_volatile_with_const_object()
97
91
util->check_result (result_stream, " test::foo_const_volatile(double 6)" );
98
92
}
99
93
100
- #if ENABLE_TEST_OF_OVERLOADED_FUNCTIONS
101
94
void
102
95
test_overloaded ()
103
96
{
104
97
test t;
105
- sigc::mem_fun<char > (&test::foo_overloaded)(t, 7 );
98
+
99
+ // We need to specify the types when using overloaded functions.
100
+
101
+ sigc::mem_fun<void , test, char > (&test::foo_overloaded)(t, 7 );
106
102
util->check_result (result_stream, " test::foo_overloaded(char 7)" );
107
103
108
- sigc::mem_fun<short > (&test::foo_overloaded)(t, 7 );
104
+ sigc::mem_fun<void , test, short > (&test::foo_overloaded)(t, 7 );
109
105
util->check_result (result_stream, " test::foo_overloaded(short 7)" );
110
106
111
- // sigc::mem_fun(&test::foo_overloaded)(t, 7);
112
- // util->check_result(result_stream, "test::foo_overloaded(short 7)");
113
-
114
- sigc::mem_fun (&test::foo_overloaded)(t, 7 , 8 );
107
+ sigc::mem_fun<double , test, int , int > (&test::foo_overloaded)(t, 7 , 8 );
115
108
util->check_result (result_stream, " test::foo_overloaded(int 7, int 8)" );
116
109
}
117
- #endif
118
110
119
111
void
120
112
test_bound ()
@@ -138,13 +130,8 @@ test_bound()
138
130
sigc::mem_fun (t, &test::foo_volatile)(9 );
139
131
util->check_result (result_stream, " test::foo_volatile(float 9)" );
140
132
141
- #if ENABLE_TEST_OF_OVERLOADED_FUNCTIONS
142
- sigc::mem_fun (t, &test::foo_overloaded)(9 , 10 );
143
- util->check_result (result_stream, " test::foo_overloaded(int 9, int 10)" );
144
-
145
- sigc::mem_fun (t, &test::foo_overloaded)(9 , 10 );
133
+ sigc::mem_fun<double , test, test, int , int >(t, &test::foo_overloaded)(9 , 10 );
146
134
util->check_result (result_stream, " test::foo_overloaded(int 9, int 10)" );
147
- #endif
148
135
}
149
136
150
137
class TestAutoDisconnect : public sigc ::trackable
@@ -188,9 +175,7 @@ main(int argc, char* argv[])
188
175
test_const_volatile ();
189
176
test_const_volatile_with_const_object ();
190
177
191
- #if ENABLE_TEST_OF_OVERLOADED_FUNCTIONS
192
- test_overload ();
193
- #endif
178
+ test_overloaded ();
194
179
195
180
test_bound ();
196
181
0 commit comments