Qt using boost::shared_ptr in a signal/slot

后端 未结 2 1682
离开以前
离开以前 2021-02-09 04:00

Is it possible, and if so, how can I create a signal/slot in Qt that is a const reference to a shared_ptr? I want a signal that looks like this:

void signal( shar

2条回答
  •  难免孤独
    2021-02-09 04:27

    According to one of the answer in this question Argument type for Qt signal and slot, does const reference qualifiers matters? , for a queued connection, the object is copied regardless of how you connect the signal and slot.

    Since you are using multiple threads, the connection is queued. If you fear the mutex cost, try using SomeClass * directly.

提交回复
热议问题