[英]Is uninitialized_copy() exception-safe?
Yes, C++03 does provide this guarantee, but it's worth double-checking for your implementations. 是的,C ++ 03确实提供了这种保证,但值得仔细检查您的实现。
From a draft copy I had on my machine, 20.4.4: 从我在机器上的草稿中,20.4.4:
All the iterators that are used as formal template parameters in the following algorithms are required to have their
operator*
return an object for which operator& is defined and returns a pointer toT
.在以下算法中用作形式模板参数的所有迭代器都需要让它们的
operator*
返回一个定义了operator&的对象,并返回一个指向T
的指针。
In the algorithmuninitialized_copy
, the formal template parameterInputIterator
is required to satisfy the requirements of an input iterator (24.1.1).在
uninitialized_copy
算法中,正式模板参数InputIterator
需要满足输入迭代器(24.1.1)的要求。
In all of the following algorithms, the formal template parameterForwardIterator
is required to satisfy the requirements of a forward iterator (24.1.3) and also to satisfy the requirements of a mutable iterator (24.1), and is required to have the property that no exceptions are thrown from increment, assignment, comparison, or dereference of valid iterators.在以下所有算法中,正式模板参数
ForwardIterator
需要满足前向迭代器(24.1.3)的要求,并且还要满足可变迭代器(24.1)的要求,并且要求具有no的属性。从有效迭代器的增量,赋值,比较或取消引用中抛出异常。
In the following algorithms, if an exception is thrown there are no effects.在以下算法中,如果抛出异常,则没有效果。
uninitialized_copy
(etc.)uninitialized_copy
(等)
So yes, that means the "possible implementation" you see on some pages can be incorrect. 所以,是的,这意味着您在某些页面上看到的“可能实现”可能不正确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.