From 943f6c3129b351946e81ef08a6a0531f828a7812 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 12 Aug 2019 13:20:38 +0200 Subject: Add few fdstream constructor overloads --- libbutl/fdstream.mxx | 74 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 24 deletions(-) (limited to 'libbutl/fdstream.mxx') diff --git a/libbutl/fdstream.mxx b/libbutl/fdstream.mxx index a3d9039..49c5dae 100644 --- a/libbutl/fdstream.mxx +++ b/libbutl/fdstream.mxx @@ -442,44 +442,57 @@ LIBBUTL_MODEXPORT namespace butl // Create an unopened object. // explicit - ifdstream (iostate e = badbit | failbit); + ifdstream (iostate = badbit | failbit); explicit ifdstream (auto_fd&&, - iostate e = badbit | failbit, + iostate = badbit | failbit, std::uint64_t pos = 0); ifdstream (auto_fd&&, fdstream_mode m, - iostate e = badbit | failbit, + iostate = badbit | failbit, std::uint64_t pos = 0); explicit ifdstream (const char*, - openmode = in, - iostate e = badbit | failbit); + iostate = badbit | failbit); explicit ifdstream (const std::string&, - openmode = in, - iostate e = badbit | failbit); + iostate = badbit | failbit); explicit ifdstream (const path&, - openmode = in, - iostate e = badbit | failbit); + iostate = badbit | failbit); + + // @@ In some implementations (for example, MSVC), iostate and openmode + // (and/or their respective constants) are not distinct enough which + // causes overload resolution errors. + // + ifdstream (const char*, + openmode, + iostate /*= badbit | failbit*/); + + ifdstream (const std::string&, + openmode, + iostate /*= badbit | failbit*/); + + ifdstream (const path&, + openmode, + iostate /*= badbit | failbit*/); ifdstream (const char*, fdopen_mode, - iostate e = badbit | failbit); + iostate = badbit | failbit); ifdstream (const std::string&, fdopen_mode, - iostate e = badbit | failbit); + iostate = badbit | failbit); ifdstream (const path&, fdopen_mode, - iostate e = badbit | failbit); + iostate = badbit | failbit); ~ifdstream () override; @@ -548,44 +561,57 @@ LIBBUTL_MODEXPORT namespace butl // Create an unopened object. // explicit - ofdstream (iostate e = badbit | failbit); + ofdstream (iostate = badbit | failbit); explicit ofdstream (auto_fd&&, - iostate e = badbit | failbit, + iostate = badbit | failbit, std::uint64_t pos = 0); ofdstream (auto_fd&&, fdstream_mode m, - iostate e = badbit | failbit, + iostate = badbit | failbit, std::uint64_t pos = 0); explicit ofdstream (const char*, - openmode = out, - iostate e = badbit | failbit); + iostate = badbit | failbit); explicit ofdstream (const std::string&, - openmode = out, - iostate e = badbit | failbit); + iostate = badbit | failbit); explicit ofdstream (const path&, - openmode = out, - iostate e = badbit | failbit); + iostate = badbit | failbit); + + // @@ In some implementations (for example, MSVC), iostate and openmode + // (and/or their respective constants) are not distinct enough which + // causes overload resolution errors. + // + ofdstream (const char*, + openmode, + iostate /*= badbit | failbit*/); + + ofdstream (const std::string&, + openmode, + iostate /*= badbit | failbit*/); + + ofdstream (const path&, + openmode, + iostate /*= badbit | failbit*/); ofdstream (const char*, fdopen_mode, - iostate e = badbit | failbit); + iostate = badbit | failbit); ofdstream (const std::string&, fdopen_mode, - iostate e = badbit | failbit); + iostate = badbit | failbit); ofdstream (const path&, fdopen_mode, - iostate e = badbit | failbit); + iostate = badbit | failbit); ~ofdstream () override; -- cgit v1.1