Jump to content
  • Advertisement
Sign in to follow this  
Quat

boost::signals2 Signals mutable?

This topic is 2131 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a class M that has signals. I want to pass a const M* to the constructor of another class B. B will subscribe to the signals of M. However this will not work because my wrapper "AddSlot()" method is not const (since signal.connect(slot) is not const).

So my question is if I should make my signals mutable so I can make AddSlot()const method.

Adding a slot doesn't change the class state, so on the surface this makes sense to me. But I'm curious if there are objections.

Share this post


Link to post
Share on other sites
Advertisement
its not true that it doesn't change the class state, it becomes a potential receptor for a signaler. If somebody wants to intercept that through a mutator, he won't suspect a const method. for me it is strange, just don't make pass it as const, this will show clearly that something will happen between those 2 :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!