开发者

Problem with boost::intrusive_ptr

There is a struct which contain intrusive_ptr field:

struct BranchFeedback : boost::counted_base {
  ...
  boost::intrusive_ptr<BPredState> theBPState;
};

There is another varibale which is defined as

std::vector< std::vector< BPredState > >           theFetchState;

Now I have instantiated an object

BranchFeedback theFeedback;

and want to assign theFetchState to that field

theFeedback.theBPState = theFetchState[anIndex][!anOne];

However compiler says some errors

error: no match for ‘operator=’ in theFeedback.theBPState = .....

How can I fi开发者_运维百科x that?


you're passing in a BPredState, but intrusive_ptr only supports operator= for pointers to the contained type (or other intrusive_ptrs)

so you could write theBPState = &(theFetchState[anIndex][!anOne]); or get an pointer or iterator to the element and use that instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜