{"id":17703355,"url":"https://github.com/zachstruck/concat_string","last_synced_at":"2025-06-21T06:05:19.105Z","repository":{"id":243643164,"uuid":"136124712","full_name":"zachstruck/concat_string","owner":"zachstruck","description":"Utility function for concatenating strings while minimizing memory allocations","archived":false,"fork":false,"pushed_at":"2020-05-08T19:52:00.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T03:47:24.171Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zachstruck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-05T05:29:35.000Z","updated_at":"2019-06-06T16:52:09.000Z","dependencies_parsed_at":"2024-06-10T11:45:43.425Z","dependency_job_id":"2fa7a02b-103a-429d-ad88-1048b1fdd521","html_url":"https://github.com/zachstruck/concat_string","commit_stats":null,"previous_names":["zachstruck/concat_string"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zachstruck/concat_string","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachstruck%2Fconcat_string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachstruck%2Fconcat_string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachstruck%2Fconcat_string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachstruck%2Fconcat_string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zachstruck","download_url":"https://codeload.github.com/zachstruck/concat_string/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachstruck%2Fconcat_string/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261073340,"owners_count":23105638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T20:22:45.158Z","updated_at":"2025-06-21T06:05:14.087Z","avatar_url":"https://github.com/zachstruck.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# concat_str\n\n[![CircleCI](https://circleci.com/gh/zachstruck/concat_string.svg?style=svg)](https://circleci.com/gh/zachstruck/concat_string)\n[![Build status](https://ci.appveyor.com/api/projects/status/6peqx48ggt636wj7?svg=true)](https://ci.appveyor.com/project/zachstruck/concat-string)\n\n`concat_str` is a utility function for concatenating multiple string types while minimizing potential free store allocations.\n\n## Illustration of the problem\n\nPotentially multiple reallocations:\n\n```c++\nusing namespace std::string_literals;\n// Pretend this is concatenating dynamic strings from functions\nauto const s = \"Hello world!\"s + ' ' + \"This is C++.\"s + ' ' + \"Here is a string.\";\n```\n\nInstead use a function that will calculate the total length and reserve the string memory once:\n\n```c++\n// Pretend this is concatenating dynamic strings from functions\nauto const s = zpp::concat_string(\"Hello world!\", ' ', \"This is C++.\", ' ', \"Here is a string.\");\n```\n\n## API\n\nMain convenience functions:\n\n* `std::string concat_string(...)`\n* `std::wstring concat_wstring(...)`\n* `std::u8string concat_u8string(...)` (requires C++20)\n* `std::u16string concat_u16string(...)`\n* `std::u32string concat_u32string(...)`\n\nGeneric template function:\n\n* ```c++\n  template \u003ctypename CharT, typename Traits, typename Alloc, typename... Ts\u003e\n  std::basic_string\u003cCharT, Traits, Alloc\u003e concat_basic_string(...)\n  ```\n\n## Supported types\n\nRequires that the underlying character types are all the same.  I.e., no mixing `char` and `wchar_t`.\n\n* Single character\n  * `char`\n  * `wchar_t`\n  * `char8_t` (requires C++20)\n  * `char16_t`\n  * `char32_t`\n* String literal\n  * `\"\"`\n  * `L\"\"`\n  * `u8\"\"`\n  * `u\"\"`\n  * `U\"\"`\n* `std::basic_string\u003c...\u003e`\n  * `std::string`\n  * `std::wstring`\n  * `std::u8string` (requires C++20)\n  * `std::u16string`\n  * `std::u32string`\n* `std::basic_string_view\u003c...\u003e` (requires C++17)\n  * `std::string_view` (requires C++17)\n  * `std::wstring_view` (requires C++17)\n  * `std::u8string_view` (requires C++20)\n  * `std::u16string_view` (requires C++17)\n  * `std::u32string_view` (requires C++17)\n* `std::initializer_list\u003cCharT\u003e`\n\n## Requirements\n\nC++11 with variadic template support\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachstruck%2Fconcat_string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzachstruck%2Fconcat_string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachstruck%2Fconcat_string/lists"}