Is this undefined behavior?
ptrdiff_t one() {
std::vector<int> test(1);
return &test[1] - &test[0];
}
Is this undefined behavior?
ptrdiff_t zero() {
std::vector<int> test;
int * end = &test[0];
int * begin = &test[0];
return end - begin;
}
If either of these are undefined behavior, can anyone help me locate the section in the C++11 spec where it describes that the subscript operator of a vector must be called on a value less than (rather than less than or equal to) size, or vice versa?
Thanks