// License: Modified MIT (NON-AI) // See the LICENSE file in the root directory for license information. // Copyright 2025 Timothy Prepscius #pragma once #include "../iterators/is_first.hpp" #include "to_string.hpp" #include namespace tjp::core { template void join_(std::string &result, is_first &first, const V &delimiter, const T & sv) { for (auto &s : sv) { if (!first.check()) result += delimiter; result.insert(result.end(), s.begin(), s.end()); } } template void join_(std::string &result, is_first &first, const V &delimiter, const U &u, const T & sv) { for (auto &s_ : sv) { auto s = u(s_); if (!first.check()) result += delimiter; result.insert(result.end(), s.begin(), s.end()); } } template std::string join(const V &delimiter, T&& ... t) { std::string result; is_first first; ((join_(result, first, delimiter, t)),...) ; return result; } template std::string join_values(const V &delimiter, T&& ... t) { std::string result; is_first first; auto u = [](auto &v) { return to_string(v); }; ((join_(result, first, delimiter, u, t)),...) ; return result; } template std::string join_with(const V &delimiter, U &&u, T&& ... t) { std::string result; is_first first; ((join_(result, first, delimiter, u, t)),...) ; return result; } } // namespace