diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2024-04-18 21:13:39 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2024-04-18 21:13:39 +0200 |
commit | 7b27c1106d77f27808639336610caeaf49f5274c (patch) | |
tree | d971b1982372a47a19d095480e9f16986b0af27d /src | |
parent | ab12565f52081c147d9f3cfb2ba4768379218c18 (diff) |
Avoid using std::deque with incomplete type
Only some containers are allowed by the standard to be declared with
incomplete types, deque is not, for vector it is ok.
Diffstat (limited to 'src')
-rw-r--r-- | src/message.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/message.cpp b/src/message.cpp index 349accb..cda2fa7 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -520,13 +520,15 @@ void DirectMessageService::doSyncWithPeers() continue; } - auto & [ thread, peer ] = peerSyncQueue.front(); + decltype(peerSyncQueue) queue; + std::swap(queue, peerSyncQueue); + lock.unlock(); - doSyncWithPeer(thread, peer); + for (auto & [ thread, peer ] : queue) + doSyncWithPeer(thread, peer); lock.lock(); - peerSyncQueue.pop_front(); } } |