Ariles
Loading...
Searching...
No Matches
concat.h
Go to the documentation of this file.
1/**
2 @file
3 @author Alexander Sherikov
4 @copyright 2024 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
5 (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
6
7 @brief
8*/
9
10#ifndef H_CPPUT_CONCAT
11#define H_CPPUT_CONCAT
12
13#include <string>
14#include <string_view>
15
16namespace cpput
17{
18 namespace concat
19 {
20 template <typename... t_String>
21 std::string reserve_strings(const t_String &...strings)
22 {
23 std::string result;
24 result.reserve((strings.size() + ...));
25 (result += ... += strings);
26 return (result);
27 }
28
29
30 template <typename... t_String>
31 std::string reserve(t_String &&...strings)
32 {
33 return (reserve_strings(std::string_view(strings)...));
34 }
35
36
37 template <typename... t_String>
38 std::string simple(t_String &&...strings)
39 {
40 std::string result;
41 (result += ... += strings);
42 return result;
43 }
44 } // namespace concat
45} // namespace cpput
46
47#endif
std::string simple(t_String &&...strings)
Definition concat.h:38
std::string reserve_strings(const t_String &...strings)
Definition concat.h:21
std::string reserve(t_String &&...strings)
Definition concat.h:31
Definition concat.h:17