From 31ccc33713e3ebd0fc0479d906f114ea33c5d616 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 13 Nov 2019 23:44:41 +0300 Subject: Add to_stream(ostream, path, bool) --- libbutl/path.ixx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libbutl/path.ixx') diff --git a/libbutl/path.ixx b/libbutl/path.ixx index b91102a..165f06a 100644 --- a/libbutl/path.ixx +++ b/libbutl/path.ixx @@ -743,4 +743,28 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. return *this; } + + template + inline std::basic_ostream& + to_stream (std::basic_ostream& os, + const basic_path& p, + bool representation) + { + os << p.string (); + + if (representation) + { + C sep (p.separator ()); + +#ifndef _WIN32 + if (sep != 0 && !p.root ()) + os << sep; +#else + if (sep != 0) + os << sep; +#endif + } + + return os; + } } -- cgit v1.1