Skip to content

Commit 9cdc901

Browse files
authored
Use =default for constructors and operator= where possible (etr#179)
Use default constructor and operator= where possible.
1 parent e0fd7a2 commit 9cdc901

File tree

10 files changed

+113
-703
lines changed

10 files changed

+113
-703
lines changed

src/httpserver/basic_auth_fail_response.hpp

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ namespace httpserver
3333
class basic_auth_fail_response : public string_response
3434
{
3535
public:
36-
basic_auth_fail_response():
37-
string_response(),
38-
realm("")
39-
{
40-
}
36+
basic_auth_fail_response() = default;
4137

4238
explicit basic_auth_fail_response(
4339
const std::string& content,
@@ -50,46 +46,17 @@ class basic_auth_fail_response : public string_response
5046
{
5147
}
5248

53-
basic_auth_fail_response(const basic_auth_fail_response& other):
54-
string_response(other),
55-
realm(other.realm)
56-
{
57-
}
58-
59-
basic_auth_fail_response(basic_auth_fail_response&& other) noexcept:
60-
string_response(std::move(other)),
61-
realm(std::move(other.realm))
62-
{
63-
}
64-
65-
basic_auth_fail_response& operator=(const basic_auth_fail_response& b)
66-
{
67-
if (this == &b) return *this;
68-
69-
(string_response&) (*this) = b;
70-
this->realm = b.realm;
49+
basic_auth_fail_response(const basic_auth_fail_response& other) = default;
50+
basic_auth_fail_response(basic_auth_fail_response&& other) noexcept = default;
51+
basic_auth_fail_response& operator=(const basic_auth_fail_response& b) = default;
52+
basic_auth_fail_response& operator=(basic_auth_fail_response&& b) = default;
7153

72-
return *this;
73-
}
74-
75-
basic_auth_fail_response& operator=(basic_auth_fail_response&& b)
76-
{
77-
if (this == &b) return *this;
78-
79-
(string_response&) (*this) = std::move(b);
80-
this->realm = std::move(b.realm);
81-
82-
return *this;
83-
}
84-
85-
~basic_auth_fail_response()
86-
{
87-
}
54+
~basic_auth_fail_response() = default;
8855

8956
int enqueue_response(MHD_Connection* connection, MHD_Response* response);
9057

9158
private:
92-
std::string realm;
59+
std::string realm = "";
9360
};
9461

9562
}

0 commit comments

Comments
 (0)