[LLVMdev] MS VS2010 std implementation: "Cannot assign iterators to two different blocks!"
Bob Floyd
bobfloyd at comcast.net
Mon Oct 4 18:52:18 PDT 2010
When using MS VS2010 there is an issue with std:
`SuccIterator` implements a partial assignment operator:
inline const _Self &operator=(const _Self &I) {
assert(Term == I.Term &&"Cannot assign iterators to two different
blocks!");
idx = I.idx;
return *this;
}
For copy construction, MS VS2010 std reserves the right, and sometimes
calls,
a method to reverse elements which does so by swap:
template<class _Ty> inline
void swap(_Ty& _Left, _Ty& _Right)
{ // exchange values stored at _Left and _Right
_Ty _Tmp = _Move(_Left);
_Left = _Move(_Right); <<<<<<<<<<<<< Needs FULL assignment operator!!!!
_Right = _Move(_Tmp);
}
When `_Ty` is `SuccIterator const` the assert "Cannot assign iterators to
two different blocks!" can fail.
Can this be a workaround:
inline const _Self &operator=(const _Self &I) {
new (this) _Self(I);
return *this;
}
The larger question is can both the assert be preserved and swap satisfied?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101004/edd32556/attachment.html>
More information about the llvm-dev
mailing list