Commit 49b2552a authored by Joe Loser's avatar Joe Loser Committed by Facebook Github Bot

Simplify _fs UDL in FixedString.h (#1149)

Summary:
- Simplify `_fs` user defined literal by removing the preprocessor branch.
- Since Folly only supports C++14 now, `#if __cplusplus >= 201402L` will always
  evaluate to true.
Pull Request resolved: https://github.com/facebook/folly/pull/1149

Reviewed By: ericniebler

Differential Revision: D15638288

Pulled By: yfeldblum

fbshipit-source-id: b690e51cbe8ba57baeb8704722e9f126f15e9d4a
parent 5a68ed6f
......@@ -3005,14 +3005,8 @@ constexpr const std::size_t& npos = detail::fixedstring::FixedStringBase::npos;
*/
template <class Char, Char... Cs>
constexpr BasicFixedString<Char, sizeof...(Cs)> operator"" _fs() noexcept {
#if __cplusplus >= 201402L
const Char a[] = {Cs..., Char(0)};
return {+a, sizeof...(Cs)};
#else
using A = const Char[sizeof...(Cs) + 1u];
// The `+` in `+A{etc}` forces the array type to decay to a pointer
return {+A{Cs..., Char(0)}, sizeof...(Cs)};
#endif
}
#pragma GCC diagnostic pop
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment