Explicitly define move constructor of Streams class. (#107)

This suppresses the following warning caused by clang-20.

```
error: definition of implicit copy constructor for 'Streams' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
```

Copy constructor or move constructor is called when std::vector re-allocates
memory. In this case, move constructor should be called, because copying
Streams instances breaks file-descriptor management.

Communication class is modified as well, since it's instance is a member of
Streams class.
This commit is contained in:
Shunsuke Shimizu 2025-04-24 14:45:32 +09:00 committed by GitHub
parent 778543b2f2
commit 38d98d9d20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1072,7 +1072,10 @@ class Communication
public:
Communication(Streams* stream): stream_(stream)
{}
void operator=(const Communication&) = delete;
Communication(const Communication&) = delete;
Communication& operator=(const Communication&) = delete;
Communication(Communication&&) = default;
Communication& operator=(Communication&&) = default;
public:
int send(const char* msg, size_t length);
int send(const std::vector<char>& msg);
@ -1109,7 +1112,10 @@ class Streams
{
public:
Streams():comm_(this) {}
void operator=(const Streams&) = delete;
Streams(const Streams&) = delete;
Streams& operator=(const Streams&) = delete;
Streams(Streams&&) = default;
Streams& operator=(Streams&&) = default;
public:
void setup_comm_channels();