File tree Expand file tree Collapse file tree 2 files changed +27
-7
lines changed
include/boost/http_proto/server Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ struct helmet_options
4141class helmet
4242{
4343 struct impl ;
44- std::unique_ptr< impl> impl_;
45-
44+ impl* impl_;
45+
4646public:
4747 /* *
4848 @brief Builds an helmet and compute its options for caching purposes.
@@ -54,6 +54,9 @@ class helmet
5454 BOOST_HTTP_PROTO_DECL
5555 ~helmet ();
5656
57+ helmet& operator =(helmet&&) noexcept ;
58+ helmet (helmet&&) noexcept ;
59+
5760 /* *
5861 @brief Iterates over cachedHeaders and apply its rules to the response params.
5962 @param p route parameter argument
Original file line number Diff line number Diff line change @@ -81,8 +81,8 @@ struct helmet::impl
8181helmet::
8282helmet (
8383 helmet_options helmet_options)
84+ : impl_(new impl())
8485{
85- impl_ = std::make_unique<impl>();
8686 impl_->options_ = std::move (helmet_options);
8787
8888 std::for_each (impl_->options_ .headers .begin (), impl_->options_ .headers .end (),
@@ -93,10 +93,27 @@ helmet(
9393 });
9494}
9595
96- /* *
97- AMLALE: This is here to prevent compiler erros from unique_ptr. (destructor doesnn't know how to destroy impl)
98- */
99- helmet::~helmet () = default ;
96+ helmet::~helmet ()
97+ {
98+ delete impl_;
99+ impl_ = nullptr ;
100+ }
101+
102+ helmet& helmet::operator =(helmet&& other) noexcept
103+ {
104+ impl_ = other.impl_ ;
105+ other.impl_ = nullptr ;
106+
107+ return *this ;
108+ }
109+
110+
111+ helmet::
112+ helmet (helmet&& other) noexcept
113+ : impl_(other.impl_)
114+ {
115+ other.impl_ = nullptr ;
116+ }
100117
101118route_result
102119helmet::
You can’t perform that action at this time.
0 commit comments