Skip to content

Commit

Permalink
prevector: add C++11-like data() method
Browse files Browse the repository at this point in the history
This returns a pointer to the beginning of the vector's data.
  • Loading branch information
laanwj committed Sep 30, 2016
1 parent 9bc6a6b commit 47314e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/prevector.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,14 @@ class prevector {
return ((size_t)(sizeof(T))) * _union.capacity;
}
}

value_type* data() noexcept {
return item_ptr(0);
}

const value_type* data() const {
return item_ptr(0);
}
};
#pragma pack(pop)

Expand Down

0 comments on commit 47314e6

Please sign in to comment.