Added ProcessStream to for running processes (on Linux) and streaming their output.

Added map() function for creating a mapping iterator.
Added mijin::pipe types for map() and join().
This commit is contained in:
2023-08-06 13:52:46 +02:00
parent 1549ef27a7
commit a1f1717e22
6 changed files with 346 additions and 1 deletions

View File

@@ -47,6 +47,22 @@ std::string join(const TRange& elements, const char* const delimiter)
return oss.str();
}
namespace pipe
{
struct Join
{
const char* delimiter;
explicit Join(const char* delimiter_) noexcept : delimiter(delimiter_) {}
};
template<typename TIterable>
auto operator|(TIterable&& iterable, const Join& joiner)
{
return join(std::forward<TIterable>(iterable), joiner.delimiter);
}
}
} // namespace mijin
#endif // !defined(MIJIN_UTIL_STRING_HPP_INCLUDED)