taocpp / taopq

C++ client library for PostgreSQL
Boost Software License 1.0
264 stars 40 forks source link

Unable to use set_notification_handler #58

Closed ajashford closed 2 years ago

ajashford commented 2 years ago

Hello,

I am trying to set a notification handler to listen for events. I have set up multiple channels and I have a notification handler who's signature is:

(XXXXX::XXXX is namespace blanked out) void XXXXX::XXXX::Connection_Notification(const tao::pq::notification &message)

When I try to execute:

conn->set_notification_handler(Connection_Notification);

I am getting an error , "no instance of overload function tao::pq::connection::set_notification_handler matches the argument list (void(const tao::pq::notification &message))"

Any ideas what is wrong with the function signature I am providing? Thanks in advance.

d-frey commented 2 years ago

Can you copy-paste the exact and full error message?

d-frey commented 2 years ago

Without further feedback from your side I'm afraid there is nothing we can do. The only thing I can advise is to double-check that XXXX::XXXX:: is really just namespaces as you say and not a class/struct. If your method is a non-static member of a class/struct, it would explain why it's not a candidate, as it can only be called on an object, not as a free-standing function.

ajashford commented 2 years ago

Hi,

In my previous response, I did a std::bind and got things to compile up. It was my mistake in that the compiler was giving the correct error in that using the function directly, it had the wrong signature since it specified a named input variable. By binding my function to a std:: function, I could then use that. Sorry for report a non-issue that was because of my mistake. Thanks to you and your team for the support.

On Mon, Dec 6, 2021, 1:39 PM Daniel Frey @.***> wrote:

Without further feedback from your side I'm afraid there is nothing we can do. The only thing I can advise is to double-check that XXXX::XXXX:: is really just namespaces as you say and not a class/struct. If your method is a non-static member of a class/struct, it would explain why it's not a candidate, as it can only be called on an object, not as a free-standing function.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/taocpp/taopq/issues/58#issuecomment-987257484, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXFSHO2DSWSYTRF5JQIOBLUPUURRANCNFSM5JCVS45Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.