Commit b02d4348 authored by Andrew Krieger's avatar Andrew Krieger Committed by Facebook Github Bot

constexpr estimateSpaceNeeded for string literals.

Summary:
Partially inspired by WillerZ's investigation into faster compiling
StringPiece work, I thought this would be an easy drop in that short
circuits some compilation logic (or possibly is strictly better, since the
StringPiece conversion method isn't constexpr).

Reviewed By: yfeldblum

Differential Revision: D6059537

fbshipit-source-id: 072f56e58aa47db10b54825cac8a05dc035b295c
parent 24a9e5fd
......@@ -408,6 +408,11 @@ estimateSpaceNeeded(T) {
return 1;
}
template <size_t N>
constexpr size_t estimateSpaceNeeded(const char (&)[N]) {
return N;
}
/**
* Everything implicitly convertible to const char* gets appended.
*/
......
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