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
?
如果不知道从哪里开始或需要专业化什么,那么我可以自己做。