This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
     new 85b82208a NO-JIRA: Trivial changes for pedantic C++17 compliance
85b82208a is described below

commit 85b82208ac69385b01d3bde5fcbf47f19adf6877
Author: Andrew Stitcher <astitc...@apache.org>
AuthorDate: Thu May 22 11:57:27 2025 +0100

    NO-JIRA: Trivial changes for pedantic C++17 compliance
---
 cpp/examples/broker.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/cpp/examples/broker.cpp b/cpp/examples/broker.cpp
index 7e8b9d5ee..469c3d1e7 100644
--- a/cpp/examples/broker.cpp
+++ b/cpp/examples/broker.cpp
@@ -151,7 +151,8 @@ class Queue {
             if (credit>0) {
                 DOUT(std::cerr << sender << " ";);
                 auto msg = messages_.front();
-                sender->add([=]{sender->sendMsg(msg);});
+                auto& s = sender; // C++17 doesn't allow lambda capture of 
structured bindings
+                sender->add([=]{s->sendMsg(msg);});
                 messages_.pop_front();
                 --credit;
                 ++current_;
@@ -226,7 +227,8 @@ void Sender::on_tracker_settle(proton::tracker& tracker) {
                 auto delivery_count = msg.delivery_count();
                 if (delivery_count<redelivery_limit) {
                     msg.delivery_count(delivery_count + 1);
-                    queue_->add([=] {queue_->queueMsg(msg);});
+                    auto& m = msg; // C++17 doesn't allow lambda capture of 
structured bindings
+                    queue_->add([=] {queue_->queueMsg(m);});
                 } else {
                     DOUT(std::cerr << "Sender:   " << this << " 
on_tracker_settle: " << tag << ": Too many redeliveries: " << delivery_count << 
"\n";);
                 }
@@ -234,7 +236,7 @@ void Sender::on_tracker_settle(proton::tracker& tracker) {
         }
         unsettled_messages_.erase(i);
     }
-};
+}
 
 void Sender::boundQueue(Queue* q, std::string qn) {
     DOUT(std::cerr << "Sender:   " << this << " bound to Queue: " << q <<"(" 
<< qn << ")\n";);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to