Tighten up the iterator requirements for the vector member templates. This is especially important for the constructors so that is_constructible<vector<T>, I, I> gives the right answer when T can not be constructed from *I. Test case included for this latter point.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178075 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2013-03-26 21:40:54 +00:00
parent 02d5e18917
commit 32d40f5f44
2 changed files with 71 additions and 16 deletions

View File

@@ -28,6 +28,10 @@ test(Iterator first, Iterator last)
assert(*i == *first);
}
struct X
{
};
int main()
{
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
@@ -43,4 +47,7 @@ int main()
test<std::vector<int, stack_allocator<int, 18> > >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
test<std::vector<int, stack_allocator<int, 18> > >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
test<std::vector<int, stack_allocator<int, 18> > >(a, an);
X x[2];
static_assert(!(std::is_constructible<std::vector<int>, X*, X*>::value), "");
}