Add string view [C++] (#4730)
authorPaul Reimer <paulreimer@users.noreply.github.com>
Thu, 10 May 2018 20:30:35 +0000 (13:30 -0700)
committerWouter van Oortmerssen <aardappel@gmail.com>
Thu, 10 May 2018 20:30:35 +0000 (13:30 -0700)
commita0a33d94a73a78959051abd1f075f93cb6f1262e
tree62f4045a17f31e25afe4008382fd39cc6d31a65b
parentb10123ff631f4e532fdaa721cdb89cc35732e3ba
Add string view [C++] (#4730)

* Add view() method on flatbuffers::String, to return a string_view type
if support for std::string_view (or alternately
std::experimental::string_view) is found

* Move detection/definition of FLATBUFFERS_STRING_VIEW to base.h, use the
macro (if it is defined) as the argument type for an overload of CreateString

* Rename String::view() to String::string_view() and use the existing c_str() method for the data pointer

* Add and explain minimum C++ standard version checks for FLATBUFFERS_STRING_VIEW implementations

* Updated preprocessor indenting for FLATBUFFERS_STRING_VIEW

* Convert FLATBUFFERS_STRING_VIEW macro to typedef in flatbuffers:: namespace, and boolean feature toggle macro FLATBUFFERS_HAS_STRING_VIEW

* Prepend flatbuffers:: namespace to disambiguate flatbuffers::string_view typedef from String::string_view()

* clang-format as-she-is-spoke for FLATBUFFERS_HAS_STRING_VIEW
include/flatbuffers/base.h
include/flatbuffers/flatbuffers.h