Skip to content

Commit

Permalink
Made Session not movable any more
Browse files Browse the repository at this point in the history
Why? cpr::Session is a complex object and while moving one has to keep all properties in mind.
An easier solution would be to wrap cpr::Session inside for example a std::shared_ptr.
  • Loading branch information
COM8 committed Dec 26, 2023
1 parent 561db4f commit fa9d8d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/cpr/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class Session : public std::enable_shared_from_this<Session> {
public:
Session();
Session(const Session& other) = delete;
Session(Session&& old) = default;
Session(Session&& old) = delete;

~Session() = default;

Session& operator=(Session&& old) noexcept = default;
Session& operator=(Session&& old) noexcept = delete;
Session& operator=(const Session& other) = delete;

void SetUrl(const Url& url);
Expand Down
4 changes: 2 additions & 2 deletions test/session_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1587,11 +1587,11 @@ TEST(CallbackTests, Move) {
auto session = Session();
session.SetDebugCallback(DebugCallback([](auto, auto, auto) {}));

auto use = +[](Session s) {
auto use = +[](Session& s) {
s.SetUrl(server->GetBaseUrl());
s.Get();
};
use(std::move(session));
use(session);
}


Expand Down

0 comments on commit fa9d8d4

Please sign in to comment.