Skip to content

Commit f96dc2e

Browse files
committed
sink::results and source::results have aggregate workaround
1 parent 7432375 commit f96dc2e

4 files changed

Lines changed: 42 additions & 0 deletions

File tree

include/boost/http_proto/sink.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ struct BOOST_SYMBOL_VISIBLE
5656
results&
5757
operator+=(
5858
results const& rv) noexcept;
59+
60+
#ifdef BOOST_HTTP_PROTO_AGGREGATE_WORKAROUND
61+
constexpr
62+
results() = default;
63+
64+
constexpr
65+
results(
66+
system::error_code ec_,
67+
std::size_t bytes_) noexcept
68+
: ec(ec_)
69+
, bytes(bytes_)
70+
{
71+
}
72+
#endif
5973
};
6074

6175
/** Consume data.

include/boost/http_proto/source.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ struct BOOST_SYMBOL_VISIBLE
6060
results&
6161
operator+=(
6262
results const& rv) noexcept;
63+
64+
#ifdef BOOST_HTTP_PROTO_AGGREGATE_WORKAROUND
65+
constexpr
66+
results() = default;
67+
68+
constexpr
69+
results(
70+
system::error_code ec_,
71+
std::size_t bytes_,
72+
bool finished_) noexcept
73+
: ec(ec_)
74+
, bytes(bytes_)
75+
, finished(finished_)
76+
{
77+
}
78+
#endif
6379
};
6480

6581
/** Produce data.

test/unit/sink.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ struct sink_test
112112
BOOST_TEST(! rv.ec.failed());
113113
BOOST_TEST_EQ(rv.bytes, 0);
114114
}
115+
116+
// sink::results aggregate workaround
117+
{
118+
sink::results rs{ {}, 0 };
119+
(void)rs;
120+
}
115121
}
116122

117123
void

test/unit/source.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ struct source_test
106106
BOOST_TEST(! rv.ec.failed());
107107
BOOST_TEST_EQ(rv.bytes, 0);
108108
}
109+
110+
// source::results aggregate workaround
111+
{
112+
source::results rs{ {}, 0, false };
113+
(void)rs;
114+
}
109115
}
110116

111117
void

0 commit comments

Comments
 (0)