Hello to everyone who I am currently using the QuickFast library, and I saw this ad using smart boost pointers:
namespace QuickFAST{
namespace Messages{
class FieldIdentity;
typedef boost::intrusive_ptr<const FieldIdentity> FieldIdentityCPtr;
typedef boost::intrusive_ptr<FieldIdentity> FieldIdentityPtr;
void QuickFAST_Export intrusive_ptr_add_ref(const FieldIdentity * ptr);
void QuickFAST_Export intrusive_ptr_release(const FieldIdentity * ptr);
void QuickFAST_Export intrusive_ptr_add_ref(FieldIdentity * ptr);
void QuickFAST_Export intrusive_ptr_release(FieldIdentity * ptr);
}
}
and I got another class that I need to create, this is the class:
namespace QuickFAST{
namespace Messages{
class QuickFAST_Export MessageField
{
public:
MessageField(const FieldIdentityCPtr & identity, const FieldCPtr & field)
: identity_(identity)
, field_(field)
{
}
private:
FieldIdentityCPtr identity_;
FieldCPtr field_;
};
}
}
so my question is: when I need to create a MessageField, I need to first prepare my FieldIdentityCPtr (respectively FieldCPtr), but this is a powerful smart pointer, so correct me if I am wrong, but I thought it might be:
FieldIdentityCPtr identityFF_= new FieldIdentity(nameFld,,idFld);
FieldCPtr fieldFF_ = new Field(typeFld,false);
MessageField(*identityFF_,*fieldFF_);
source
share