@@ -57,42 +57,54 @@ namespace boost { namespace network {
57
57
58
58
struct source_directive {
59
59
60
+ boost::variant<
61
+ typename string<tags::default_string>::type,
62
+ typename string<tags::default_wstring>::type,
63
+ boost::shared_future<string<tags::default_string>::type>,
64
+ boost::shared_future<string<tags::default_wstring>::type>
65
+ > source_;
66
+
60
67
explicit source_directive (string<tags::default_string>::type const & source)
61
68
: source_(source)
62
69
{ };
63
-
64
70
explicit source_directive (string<tags::default_wstring>::type const & source)
65
71
: source_(source)
66
72
{ };
67
-
68
73
explicit source_directive (boost::shared_future<typename string<tags::default_string>::type> const & source)
69
74
: source_(source)
70
75
{ };
71
-
72
76
explicit source_directive (boost::shared_future<typename string<tags::default_wstring>::type> const & source)
73
77
: source_(source)
74
78
{ };
75
79
80
+ source_directive (source_directive const & other)
81
+ : source_(other.source_) {}
82
+
76
83
template <class Tag >
77
84
struct value :
78
85
mpl::if_<
79
- is_async<Tag>,
80
- boost::shared_future<typename string<Tag>::type>,
81
- typename mpl::if_<
82
- is_sync<Tag>,
83
- typename string<Tag>::type,
84
- unsupported_tag<Tag>
85
- >::type
86
+ is_async<Tag>,
87
+ boost::shared_future<typename string<Tag>::type>,
88
+ typename mpl::if_<
89
+ mpl::or_<
90
+ is_sync<Tag>,
91
+ is_same<Tag, tags::default_string>,
92
+ is_same<Tag, tags::default_wstring>
93
+ >,
94
+ typename string<Tag>::type,
95
+ unsupported_tag<Tag>
96
+ >::type
86
97
>
87
98
{};
88
99
89
100
template <class Message >
90
101
struct source_visitor : boost::static_visitor<> {
91
102
Message const & message_;
92
- typedef typename Message::tag Tag;
93
103
source_visitor (Message const & message)
94
104
: message_(message) {}
95
- void operator ()(typename value<Tag>::type & source) const {
105
+ source_visitor (source_visitor const & other)
106
+ : message_(other.message_) {}
107
+ void operator ()(typename value<typename Message::tag>::type const & source) const {
96
108
message_.source (source);
97
109
}
98
110
template <class T > void operator ()(T const &) const {
@@ -104,15 +116,7 @@ namespace boost { namespace network {
104
116
void operator () (Message<Tag> const & msg) const {
105
117
apply_visitor (source_visitor<Message<Tag> >(msg), source_);
106
118
}
107
-
108
- private:
109
-
110
- boost::variant<
111
- typename string<tags::default_string>::type,
112
- typename string<tags::default_wstring>::type,
113
- boost::shared_future<string<tags::default_string>::type>,
114
- boost::shared_future<string<tags::default_wstring>::type>
115
- > source_;
119
+
116
120
};
117
121
118
122
} // namespace impl
0 commit comments