File tree Expand file tree Collapse file tree 4 files changed +70
-11
lines changed Expand file tree Collapse file tree 4 files changed +70
-11
lines changed Original file line number Diff line number Diff line change 14
14
#include < boost/network/message/transformers/selectors.hpp>
15
15
#include < boost/network/message/transformers/to_upper.hpp>
16
16
17
+ #include < boost/type_traits.hpp>
18
+
17
19
namespace boost { namespace network {
18
20
namespace impl {
19
21
template <class Algorithm , class Selector >
20
22
struct get_real_algorithm {
21
- typedef typename Algorithm::template type<Selector> type;
23
+ typedef typename boost::function_traits<
24
+ typename boost::remove_pointer<
25
+ Algorithm
26
+ >::type
27
+ >
28
+ ::result_type::
29
+ template type<
30
+ typename boost::function_traits<
31
+ typename boost::remove_pointer<
32
+ Selector
33
+ >::type
34
+ >::result_type
35
+ > type;
22
36
};
23
37
24
38
template <class Algorithm , class Selector >
Original file line number Diff line number Diff line change 9
9
10
10
namespace boost { namespace network {
11
11
namespace selectors {
12
- struct source_selector { } ;
13
- struct destination_selector { } ;
12
+ struct source_selector ;
13
+ struct destination_selector ;
14
14
}; // namespace selectors
15
15
16
- extern selectors::source_selector source_;
17
- extern selectors::destination_selector destination_;
16
+ selectors::source_selector source_ (selectors::source_selector);
17
+ selectors::destination_selector destination_ (selectors::destination_selector);
18
+
19
+ namespace selectors {
20
+ struct source_selector {
21
+ private:
22
+ source_selector () {};
23
+ source_selector (source_selector const &) {};
24
+ friend source_selector boost::network::source_ (source_selector);
25
+ };
26
+
27
+ struct destination_selector {
28
+ private:
29
+ destination_selector () {};
30
+ destination_selector (destination_selector const &) {};
31
+ friend destination_selector boost::network::destination_ (destination_selector);
32
+ };
33
+ }; // namespace selectors
34
+
35
+ typedef selectors::source_selector (*source_selector_t )(selectors::source_selector);
36
+ typedef selectors::destination_selector (*destination_selector_t )(selectors::destination_selector);
37
+
38
+ inline selectors::source_selector source_ (selectors::source_selector) {
39
+ return selectors::source_selector ();
40
+ };
41
+
42
+ inline selectors::destination_selector destination_ (selectors::destination_selector) {
43
+ return selectors::destination_selector ();
44
+ };
18
45
19
46
}; // namespace network
20
47
Original file line number Diff line number Diff line change @@ -49,12 +49,30 @@ namespace boost { namespace network {
49
49
50
50
}; // namespace impl
51
51
52
- struct to_upper_placeholder {
53
- template <class Selector >
54
- struct type : public impl ::to_upper_transformer<Selector> { };
55
- } ;
52
+ namespace detail {
53
+ struct to_upper_placeholder_helper ;
54
+ };
55
+
56
+ detail::to_upper_placeholder_helper to_upper_ (detail::to_upper_placeholder_helper);
57
+
58
+ namespace detail {
59
+
60
+ struct to_upper_placeholder_helper {
61
+ template <class Selector >
62
+ struct type : public impl ::to_upper_transformer<Selector> { };
63
+ private:
64
+ to_upper_placeholder_helper () {};
65
+ to_upper_placeholder_helper (to_upper_placeholder_helper const &) {};
66
+ friend to_upper_placeholder_helper boost::network::to_upper_ (to_upper_placeholder_helper);
67
+ };
68
+
69
+ };
70
+
71
+ typedef detail::to_upper_placeholder_helper (*to_upper_placeholder)(detail::to_upper_placeholder_helper);
56
72
57
- extern to_upper_placeholder to_upper_;
73
+ inline detail::to_upper_placeholder_helper to_upper_ (detail::to_upper_placeholder_helper) {
74
+ return detail::to_upper_placeholder_helper ();
75
+ };
58
76
59
77
}; // namespace network
60
78
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ project network_test :
8
8
requirements
9
9
<include>../../../
10
10
<source>/boost//unit_test_framework
11
- <link>static
11
+ # <link>static
12
12
;
13
13
14
14
unit-test message_test : message_test.cpp ;
You can’t perform that action at this time.
0 commit comments