Make concat_string_ref_count constexpr
This commit is contained in:
parent
ad7fc183d1
commit
6596cce8fb
|
@ -190,13 +190,13 @@ StringRef make_string_ref(BlockAllocator &alloc, const StringRef &src) {
|
||||||
|
|
||||||
// private function used in concat_string_ref. this is the base
|
// private function used in concat_string_ref. this is the base
|
||||||
// function of concat_string_ref_count().
|
// function of concat_string_ref_count().
|
||||||
inline size_t concat_string_ref_count(size_t acc) { return acc; }
|
inline constexpr size_t concat_string_ref_count(size_t acc) { return acc; }
|
||||||
|
|
||||||
// private function used in concat_string_ref. This function counts
|
// private function used in concat_string_ref. This function counts
|
||||||
// the sum of length of given arguments. The calculated length is
|
// the sum of length of given arguments. The calculated length is
|
||||||
// accumulated, and passed to the next function.
|
// accumulated, and passed to the next function.
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
size_t concat_string_ref_count(size_t acc, const StringRef &value,
|
constexpr size_t concat_string_ref_count(size_t acc, const StringRef &value,
|
||||||
Args &&...args) {
|
Args &&...args) {
|
||||||
return concat_string_ref_count(acc + value.size(),
|
return concat_string_ref_count(acc + value.size(),
|
||||||
std::forward<Args>(args)...);
|
std::forward<Args>(args)...);
|
||||||
|
|
Loading…
Reference in New Issue