mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 10:07:41 +08:00
Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. These are just rebranded 'operator[]', and should be noexcept like it is.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356435 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -26,6 +26,10 @@ int main(int, char**)
|
||||
typedef std::string S;
|
||||
S s("0123456789");
|
||||
const S& cs = s;
|
||||
ASSERT_SAME_TYPE(decltype( s[0]), typename S::reference);
|
||||
ASSERT_SAME_TYPE(decltype(cs[0]), typename S::const_reference);
|
||||
LIBCPP_ASSERT_NOEXCEPT( s[0]);
|
||||
LIBCPP_ASSERT_NOEXCEPT( cs[0]);
|
||||
for (S::size_type i = 0; i < cs.size(); ++i)
|
||||
{
|
||||
assert(s[i] == static_cast<char>('0' + i));
|
||||
@@ -40,6 +44,10 @@ int main(int, char**)
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("0123456789");
|
||||
const S& cs = s;
|
||||
ASSERT_SAME_TYPE(decltype( s[0]), typename S::reference);
|
||||
ASSERT_SAME_TYPE(decltype(cs[0]), typename S::const_reference);
|
||||
LIBCPP_ASSERT_NOEXCEPT( s[0]);
|
||||
LIBCPP_ASSERT_NOEXCEPT( cs[0]);
|
||||
for (S::size_type i = 0; i < cs.size(); ++i)
|
||||
{
|
||||
assert(s[i] == static_cast<char>('0' + i));
|
||||
|
Reference in New Issue
Block a user