blob: ead86b569e3d472658fe99fb7e75cfb07d9e3ae0 [file] [log] [blame]
// Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/lib/fxl/strings/concatenate.h"
namespace fxl {
std::string Concatenate(std::initializer_list<std::string_view> string_views) {
std::string result;
size_t result_size = 0;
for (const std::string_view& string_view : string_views) {
result_size += string_view.size();
}
result.reserve(result_size);
for (const std::string_view& string_view : string_views) {
result.append(string_view.data(), string_view.size());
}
return result;
}
} // namespace fxl