mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
dropEmptyInitThenConcatStringsSep -> concatStringSep: empty separator
When the separator is empty, no difference is observable. Note that concatStringsSep has centralized definitions. This adds the required definitions. Alternatively, `strings-inline.hh` could be included at call sites.
This commit is contained in:
parent
d40fdb5711
commit
97e01107ec
|
@ -9,4 +9,11 @@ template std::string concatStringsSep(std::string_view, const Strings &);
|
|||
template std::string concatStringsSep(std::string_view, const StringSet &);
|
||||
template std::string concatStringsSep(std::string_view, const std::vector<std::string> &);
|
||||
|
||||
typedef std::string_view strings_2[2];
|
||||
template std::string concatStringsSep(std::string_view, const strings_2 &);
|
||||
typedef std::string_view strings_3[3];
|
||||
template std::string concatStringsSep(std::string_view, const strings_3 &);
|
||||
typedef std::string_view strings_4[4];
|
||||
template std::string concatStringsSep(std::string_view, const strings_4 &);
|
||||
|
||||
} // namespace nix
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <sstream>
|
||||
#include <optional>
|
||||
|
||||
#include "strings.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
void initLibUtil();
|
||||
|
@ -69,7 +71,7 @@ auto concatStrings(Parts && ... parts)
|
|||
-> std::enable_if_t<(... && std::is_convertible_v<Parts, std::string_view>), std::string>
|
||||
{
|
||||
std::string_view views[sizeof...(parts)] = { parts... };
|
||||
return dropEmptyInitThenConcatStringsSep({}, views);
|
||||
return concatStringsSep({}, views);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue