From 6596cce8fb7bf6160c34e409f721d36bdd8d5d1b Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 22 Jun 2022 23:59:07 +0900 Subject: [PATCH] Make concat_string_ref_count constexpr --- src/allocator.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/allocator.h b/src/allocator.h index 89250d42..97b9a418 100644 --- a/src/allocator.h +++ b/src/allocator.h @@ -190,14 +190,14 @@ StringRef make_string_ref(BlockAllocator &alloc, const StringRef &src) { // private function used in concat_string_ref. this is the base // 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 // the sum of length of given arguments. The calculated length is // accumulated, and passed to the next function. template -size_t concat_string_ref_count(size_t acc, const StringRef &value, - Args &&...args) { +constexpr size_t concat_string_ref_count(size_t acc, const StringRef &value, + Args &&...args) { return concat_string_ref_count(acc + value.size(), std::forward(args)...); }