mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 02:53:02 +08:00
Remove CharType template paramter from Strings::join()
This commit is contained in:
parent
c797ab4794
commit
61777425db
@ -48,18 +48,18 @@ namespace vcpkg::Strings
|
|||||||
|
|
||||||
bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern);
|
bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern);
|
||||||
|
|
||||||
template<class Container, class Transformer, class CharType>
|
template<class Container, class Transformer>
|
||||||
std::basic_string<CharType> join(const CharType* delimiter, const Container& v, Transformer transformer)
|
std::string join(const char* delimiter, const Container& v, Transformer transformer)
|
||||||
{
|
{
|
||||||
const auto begin = v.begin();
|
const auto begin = v.begin();
|
||||||
const auto end = v.end();
|
const auto end = v.end();
|
||||||
|
|
||||||
if (begin == end)
|
if (begin == end)
|
||||||
{
|
{
|
||||||
return std::basic_string<CharType>();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::basic_string<CharType> output;
|
std::string output;
|
||||||
output.append(transformer(*begin));
|
output.append(transformer(*begin));
|
||||||
for (auto it = std::next(begin); it != end; ++it)
|
for (auto it = std::next(begin); it != end; ++it)
|
||||||
{
|
{
|
||||||
@ -69,8 +69,8 @@ namespace vcpkg::Strings
|
|||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
template<class Container, class CharType>
|
template<class Container>
|
||||||
std::basic_string<CharType> join(const CharType* delimiter, const Container& v)
|
std::string join(const char* delimiter, const Container& v)
|
||||||
{
|
{
|
||||||
using Element = decltype(*v.begin());
|
using Element = decltype(*v.begin());
|
||||||
return join(delimiter, v, [](const Element& x) -> const Element& { return x; });
|
return join(delimiter, v, [](const Element& x) -> const Element& { return x; });
|
||||||
|
Loading…
Reference in New Issue
Block a user