diff options
| author | Curtis.Bezault <cubezaul@microsoft.com> | 2019-04-09 15:04:44 -0700 |
|---|---|---|
| committer | Curtis.Bezault <cubezaul@microsoft.com> | 2019-04-09 15:04:44 -0700 |
| commit | 79682317c9e087dc1d1ae450e3edd03b0fa0cc59 (patch) | |
| tree | f8d8925970b5ebd31f123248e3e1472bd86e4e43 /toolsrc/include | |
| parent | e9d2a830206fac08f47e55c739a3f3fbe29855e9 (diff) | |
| download | vcpkg-79682317c9e087dc1d1ae450e3edd03b0fa0cc59.tar.gz vcpkg-79682317c9e087dc1d1ae450e3edd03b0fa0cc59.zip | |
Print what port installed confliciting files
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg/base/strings.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index 4b39b0a28..04e85107e 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -56,12 +56,10 @@ namespace vcpkg::Strings bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern); bool ends_with(const std::string& s, StringLiteral pattern); - template<class Container, class Transformer> - std::string join(const char* delimiter, const Container& v, Transformer transformer) + template<class InputIterator, class Transformer> + std::string join(const char* delimiter, InputIterator begin, InputIterator end, + Transformer transformer) { - const auto begin = v.begin(); - const auto end = v.end(); - if (begin == end) { return std::string(); @@ -77,6 +75,24 @@ namespace vcpkg::Strings return output; } + + template<class Container, class Transformer> + std::string join(const char* delimiter, const Container& v, Transformer transformer) + { + const auto begin = v.begin(); + const auto end = v.end(); + + return join(delimiter, begin, end, transformer); + } + + template<class InputIterator> + std::string join(const char* delimiter, InputIterator begin, InputIterator end) + { + using Element = decltype(*begin); + return join(delimiter, begin, end, + [](const Element& x) -> const Element& { return x; }); + } + template<class Container> std::string join(const char* delimiter, const Container& v) { |
