Handle small_vectors with 0 inline capacity correctly
authorChristopher Dykes <cdykes@fb.com>
Tue, 19 Jul 2016 22:44:31 +0000 (15:44 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Tue, 19 Jul 2016 22:53:32 +0000 (15:53 -0700)
commit6a3ea69693839f0521620a7ace498b9c038924d4
tree95e4e3af683141497439715775c68094e22fbc72
parent26b139fc3520828f080d459b0f8cbd271cab7a89
Handle small_vectors with 0 inline capacity correctly

Summary: It is an error to attempt to get the size of a zero length array, such as `unsigned char[0]`, which is what you get if `MaxInline` has been passed in as 0. We can work around this by simply defining `InlineStorageType` to be `void*` if the size is exactly 0, which will result in the capacity correctly being stored out of line.

Reviewed By: yfeldblum

Differential Revision: D3572898

fbshipit-source-id: c96bb7cc6a890044bb74b0f6d5238c503552ee25
folly/small_vector.h