summaryrefslogtreecommitdiff
path: root/services/incremental/path.h
diff options
context:
space:
mode:
Diffstat (limited to 'services/incremental/path.h')
-rw-r--r--services/incremental/path.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/services/incremental/path.h b/services/incremental/path.h
index 3e5fd21b6535..e12e1d027055 100644
--- a/services/incremental/path.h
+++ b/services/incremental/path.h
@@ -89,15 +89,25 @@ std::optional<bool> isEmptyDir(std::string_view dir);
bool startsWith(std::string_view path, std::string_view prefix);
template <class... Paths>
-std::string join(std::string_view first, std::string_view second, Paths&&... paths) {
- std::string result;
+std::string join(std::string&& first, std::string_view second, Paths&&... paths) {
+ std::string& result = first;
{
using std::size;
result.reserve(first.size() + second.size() + 1 + (sizeof...(paths) + ... + size(paths)));
}
- result.assign(first);
- (details::append_next_path(result, second), ..., details::append_next_path(result, paths));
- return result;
+ (details::append_next_path(result, second), ...,
+ details::append_next_path(result, std::forward<Paths>(paths)));
+ return std::move(result);
+}
+
+template <class... Paths>
+std::string join(std::string_view first, std::string_view second, Paths&&... paths) {
+ return path::join(std::string(), first, second, std::forward<Paths>(paths)...);
+}
+
+template <class... Paths>
+std::string join(const char* first, std::string_view second, Paths&&... paths) {
+ return path::join(std::string_view(first), second, std::forward<Paths>(paths)...);
}
} // namespace android::incremental::path