Another vector debug mode test, and a static test on Allocator::value_type. This partially addresses http://llvm.org/bugs/show_bug.cgi?id=15576.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178064 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2013-03-26 19:04:56 +00:00
parent d1c0082675
commit 02d5e18917
2 changed files with 11 additions and 0 deletions

View File

@ -502,6 +502,9 @@ public:
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
_LIBCPP_INLINE_VISIBILITY
vector()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)

View File

@ -45,5 +45,13 @@ int main()
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
}
{
int a1[] = {1, 3, 7, 9, 10};
std::vector<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
std::vector<int>::const_iterator i = c1.begin();
std::vector<int> c2 = std::move(c1);
std::vector<int>::iterator j = c2.erase(i);
assert(*j == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}