This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
noexcept
issues with filesystem operationsSection: 31.12.13.5 [fs.op.copy.file], 31.12.13.7 [fs.op.create.directories], 31.12.13.32 [fs.op.remove.all] Status: C++20 Submitter: Tim Song Opened: 2017-08-23 Last modified: 2021-06-06
Priority: Not Prioritized
View all other issues in [fs.op.copy.file].
View all issues with C++20 status.
Discussion:
create_directories
may need to create temporary path
s, and remove_all
may need to create temporary
path
s and/or directory_iterator
s. These operations may require a potentially throwing memory allocation.
Implementations of copy_file
may wish to dynamically allocate the buffer used for copying when the underlying OS
doesn't supply a copy API directly. This can happen indirectly, e.g., by using <fstream>
facilities to
perform the copying without supplying a custom buffer. Unless LWG wishes to prohibit using a dynamically allocated buffer
in this manner, the noexcept
should be removed.
[2017-11 Albuquerque Wednesday night issues processing]
Moved to Ready
[2018-3-17 Adopted in Jacksonville]
Proposed resolution:
This wording is relative to N4687.
Edit 31.12.4 [fs.filesystem.syn], header <filesystem>
synopsis, as indicated:
namespace std::filesystem { [âĻ] bool copy_file(const path& from, const path& to); bool copy_file(const path& from, const path& to, error_code& ec)noexcept; bool copy_file(const path& from, const path& to, copy_options option); bool copy_file(const path& from, const path& to, copy_options option, error_code& ec)noexcept; [âĻ] bool create_directories(const path& p); bool create_directories(const path& p, error_code& ec)noexcept; [âĻ] uintmax_t remove_all(const path& p); uintmax_t remove_all(const path& p, error_code& ec)noexcept; [âĻ] }
Edit [fs.op.copy_file] as indicated:
bool copy_file(const path& from, const path& to); bool copy_file(const path& from, const path& to, error_code& ec)noexcept;-1- Returns: [âĻ]
-2- Throws: [âĻ]
bool copy_file(const path& from, const path& to, copy_options options); bool copy_file(const path& from, const path& to, copy_options options, error_code& ec)noexcept;-3- Requires: [âĻ]
-4- Effects: [âĻ]
-5- Returns: [âĻ]
-6- Throws: [âĻ]
-7- Complexity: [âĻ]
Edit [fs.op.create_directories] as indicated:
bool create_directories(const path& p); bool create_directories(const path& p, error_code& ec)noexcept;-1- Effects: [âĻ]
-2- Postconditions: [âĻ]
-3- Returns: [âĻ]
-4- Throws: [âĻ]
-5- Complexity: [âĻ]
Edit [fs.op.remove_all] as indicated:
uintmax_t remove_all(const path& p); uintmax_t remove_all(const path& p, error_code& ec)noexcept;-1- Effects: [âĻ]
-2- Postconditions: [âĻ]
-3- Returns: [âĻ]
-4- Throws: [âĻ]