Skip to content

#642 made usage of Node::Subscribe with lambdas worse #880

@jmachowinski

Description

@jmachowinski

Environment

  • OS Version: Ubuntu 26.04
  • Source or binary build?
    Source jetty build

Description

The changes introduced in #642 made the subscription API substantially worse if using lambdas.

Before the changes one could do

gzNode->Subscribe<gz::msgs::CameraInfo>( topic, [](
     const gz::msgs::CameraInfo& gzMsg) { });

if you are using lambdas now,

// NOT COMPILING
gzNode->Subscribe( topic, [](const gz::msgs::CameraInfo& gzMsg) { });

fails as the deduction for lambda argument fails, therefore one needs to do

gzNode->Subscribe( topic, [](
  std::function<void(const gz::msgs::CameraI&)>{const gz::msgs::CameraInfo& gzMsg) { }});

This is a clear step backwards in the usability of the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions