#ifndef _GLIBCXX_DEBUG_PEDANTIC
# define _GLIBCXX_DEBUG_PEDANTIC 1
#endif
#include <debug/vector>
#include <testsuite_hooks.h>
using __gnu_debug::vector;
bool test = true;
void test03()
{
vector<int> v(10, 17);
v.reserve(30);
vector<int>::iterator before = v.begin() + 6;
vector<int>::iterator at = before + 1;
vector<int>::iterator after = at;
at = v.insert(at, 42);
VERIFY(before._M_dereferenceable());
VERIFY(at._M_dereferenceable());
VERIFY(after._M_singular());
before = v.begin() + 6;
at = before + 1;
v.insert(at, 3, 42);
VERIFY(before._M_dereferenceable());
VERIFY(at._M_singular());
static int data[] = { 2, 3, 5, 7 };
before = v.begin() + 6;
at = before + 1;
v.insert(at, &data[0], &data[0] + 4);
VERIFY(before._M_dereferenceable());
VERIFY(at._M_singular());
before = v.begin() + 6;
at = before + 1;
v.insert(at, 30, 17);
VERIFY(before._M_singular());
VERIFY(at._M_singular());
vector<int> v2;
v2.reserve(100);
at = v2.begin();
v2.insert(at, 100, 17);
at = v2.end() - 1;
before = v2.begin();
VERIFY(at._M_dereferenceable());
VERIFY(before._M_dereferenceable());
at = v2.insert(at, 42);
VERIFY(at._M_dereferenceable());
VERIFY(before._M_singular());
}
#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
template class __gnu_cxx::__mt_alloc<int>;
#endif
int main()
{
test03();
return 0;
}