Add non-const data() method to FBString (#1116)
Summary: - As of C++17, `std::string` contains a non-const `data()` member function. This is useful when working with C APIs that have `char*` output parameters. - Implements P0272 for `FBString`: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0272r1.html Example of workaround without this: ``` fbstring s{}; some_api(&s.front()); ``` - The expression `&s.front()` above causes undefined behavior since the string is empty. - Add non-const public member function `data()` to `fbstring` which delegates to `fbstring_core`. Pull Request resolved: https://github.com/facebook/folly/pull/1116 Reviewed By: Orvid Differential Revision: D15213884 Pulled By: yfeldblum fbshipit-source-id: f533542db0a7e34c09a622e5257d7c1e66ab75e2
Showing
Please register or sign in to comment