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.
精彩评论