gelldur / EventBus

A lightweight and very fast event bus / event framework for C++17
Apache License 2.0
371 stars 81 forks source link

ProtectedEventStream::process can't consume the _queue #46

Open gitbufenshuo opened 2 years ago

gitbufenshuo commented 2 years ago
                         // ProtectedEventStream::process method
                         if(limit >= _queue.size())
            {
                processEvents.reserve(_queue.size());
                std::swap(processEvents, _queue);
            }
            else
            {
                const auto countElements = std::min(limit, _queue.size());
                processEvents.reserve(countElements);
                std::move(_queue.begin(),
                          std::next(_queue.begin(), countElements),
                          std::back_inserter(processEvents));
                    // _queue.size() remains unchanged
                         }
gelldur commented 2 years ago

Thank you, fixed.