vec.data() and vec.data() + vec.size() are both safe even if the vector is empty.

llvm-svn: 234436
This commit is contained in:
Rui Ueyama 2015-04-08 21:13:23 +00:00
parent 1e67707a66
commit 5d6ff3d2ee
1 changed files with 2 additions and 4 deletions

View File

@ -199,14 +199,12 @@ protected:
class atom_collection_vector : public atom_collection<T> {
public:
atom_iterator<T> begin() const override {
auto *it = _atoms.empty() ? nullptr
: reinterpret_cast<const void *>(_atoms.data());
const void *it = _atoms.data();
return atom_iterator<T>(*this, it);
}
atom_iterator<T> end() const override {
auto *it = _atoms.empty() ? nullptr : reinterpret_cast<const void *>(
_atoms.data() + _atoms.size());
const void *it = _atoms.data() + _atoms.size();
return atom_iterator<T>(*this, it);
}