[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] [PATCH] Define operator<<(fs::path) in the right namespace

From: Vadim Zeitlin
Subject: [lmi] [PATCH] Define operator<<(fs::path) in the right namespace
Date: Wed, 10 Feb 2016 21:06:20 +0100


 While testing compilation of SOA code with the new compilers (MSVC14 and
g++ 4.9), I started getting a lot of errors for all the code constructing
error messages with paths like this:

        fs::path path = ...;
        std::ostringstream oss;
        oss << "Failed to open '" << path << "'";

 Looking at this closer, I actually don't understand how could it compile
before with Boost 1.33 (later versions, which I used until very recently,
define operator<<() inside the path class itself) because operator<<() is
defined in the global namespace in path_utility.hpp and so has no reason to
be found if the code like above is inside some other namespace, as the
compiler is only supposed to check that namespace as well as std namespace
and boost::filesystem one because of argument-depending lookup rule.

 So, AFAICS, the current code is just incorrect and only happens to work
because there is no code using operator<<(fs::path) inside a namespace yet.
If you agree, please apply the attached patch, which was tested it with g++
4.9 (and MSVC14).


Attachment: 0001-Define-operator-for-fs-path-in-the-right-namespace.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]