boost::bind 是否有 QPointer 专业化
boost::bind
处理 boost::shared_ptr
的方式与原始指针相同。
QObject * object(new QObject);
boost::shared_ptr<QObject> sharedObject(new QObject);
bind(&QObject::setObjectName, object, _1)( "name" );
bind(&QObject::setObjectName, sharedObject, _1)( "name" );
我希望有一个 boost::bind
来处理 QPointers
作为原始指针。
QPointer<QObject> guardedObject(new QObject);
// i want to write it like this
bind(&QObject::setObjectName, guardedObject, _1)( "name" );
//now i have to do it like this
bind(&QObject::setObjectName, bind(&QPointer<QObject>::data, guardedObject), _1)( "name" );
有没有人专门研究过QPointer
?
如果没有,你知道从哪里开始或者需要专门做什么,所以我可以自己做。
boost::bind
handles boost::shared_ptr
the same way as raw pointers.
QObject * object(new QObject);
boost::shared_ptr<QObject> sharedObject(new QObject);
bind(&QObject::setObjectName, object, _1)( "name" );
bind(&QObject::setObjectName, sharedObject, _1)( "name" );
I would love to have a boost::bind
that handles QPointers
as raw pointers pointer.
QPointer<QObject> guardedObject(new QObject);
// i want to write it like this
bind(&QObject::setObjectName, guardedObject, _1)( "name" );
//now i have to do it like this
bind(&QObject::setObjectName, bind(&QPointer<QObject>::data, guardedObject), _1)( "name" );
Is there anyone who has made the specialization for QPointer
?
If not do you know where to start or what needs to be specialized, so I can do it myself.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加
get_pointer
函数应该可以解决问题:Adding this overload of the
get_pointer
function should do the trick: