boost::侵入性的\u ptr存在问题
存在一个包含侵入性\u ptr字段的结构:boost::侵入性的\u ptr存在问题,boost,vector,assign,Boost,Vector,Assign,存在一个包含侵入性\u ptr字段的结构: struct BranchFeedback : boost::counted_base { ... boost::intrusive_ptr<BPredState> theBPState; }; 想给这个字段分配一个新的值吗 theFeedback.theBPState = theFetchState[anIndex][!anOne]; 然而,编译器说有些错误 error: no match for ‘operator=’ in
struct BranchFeedback : boost::counted_base {
...
boost::intrusive_ptr<BPredState> theBPState;
};
想给这个字段分配一个新的值吗
theFeedback.theBPState = theFetchState[anIndex][!anOne];
然而,编译器说有些错误
error: no match for ‘operator=’ in theFeedback.theBPState = .....
如何修复此问题?您正在以BPredState传递,但仅支持运算符=作为指向所包含类型(或其他入侵类型)的指针 因此,您可以编写bpstate=&(theftchstate[anIndex][!anOne]);或者获取指向该元素的指针或迭代器并使用它
theFeedback.theBPState = theFetchState[anIndex][!anOne];
error: no match for ‘operator=’ in theFeedback.theBPState = .....