From 5cefe7890fc32560d0c99e953251000cc983932b Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 4 Feb 2023 19:55:17 +0300 Subject: [PATCH] Remove path converting constructors from types convertible to path sources. This causes ambiguities in users' code where the previously added conversion from user-defined types that have a conversion to one of the path source types: struct my_class { operator std::string() const; }; std::string to_string(std::string const&); std::string to_string(boost::filesystem::path const&); to_string(my_class()); The above call is ambiguous as the conversion operator in my_class and a converting constructor in boost::filesystem::path from my_class are both available and have equivalent ranks. Removing the conversion constructors from boost::filesystem::path means users will have to explicitly cast their types to one of the path source types before constructing path. In order to preserve backward compatibility with operator== and operator!= for paths that also accepted source types (path::string_type, const path::value_type*), we have to update path::compare and comparison operators to accept types that are convertible to source types. Fixes https://github.com/boostorg/filesystem/issues/273. --- doc/release_history.html | 5 + .../boost/filesystem/detail/path_traits.hpp | 94 ++++---- include/boost/filesystem/directory.hpp | 4 +- include/boost/filesystem/path.hpp | 225 +++++++++++++++--- test/path_test.cpp | 14 ++ 5 files changed, 261 insertions(+), 81 deletions(-) diff --git a/doc/release_history.html b/doc/release_history.html index 74f0d06..1e72994 100644 --- a/doc/release_history.html +++ b/doc/release_history.html @@ -39,6 +39,11 @@ +

1.82.0

+ +

1.81.0