Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"protected" prevents creation by Converter::null_owned() #384

Closed
ssenffses opened this issue Jan 27, 2025 · 2 comments
Closed

"protected" prevents creation by Converter::null_owned() #384

ssenffses opened this issue Jan 27, 2025 · 2 comments

Comments

@ssenffses
Copy link

ssenffses commented Jan 27, 2025

Hello - I'm trying to initialize a yet-unassigned Subscriber member variable in a class constructor, for which the only way I've found so far is to add

_mysubscriber(interop::detail::null<zenoh::Subscriber<void>>())

to the class initializer list. But this fails during compilation because Converter::null_owned() cannot access the protected constructors of SubscriberBase.

It seems to work fine like this with Publisher, though of course it doesn't look like the ideal way.

@DenisBiryukov91
Copy link
Contributor

Hello, subscriber does not have an empty constructor by design (since non-initialized subscriber does not make much sense), you can either store it in a pointer or in std::optional if you absolutely can not initialize it in the class initializer list.

@ssenffses
Copy link
Author

Ok thx, I will find a way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants