This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

### 2663. Enable efficient retrieval of file size from `directory_entry`

Section: 29.12.13.15 [fs.op.file.size] Status: Resolved Submitter: Gor Nishanov Opened: 2014-05-22 Last modified: 2021-06-06

Priority: 2

View all issues with Resolved status.

Discussion:

On Windows, the `FindFileData WIN32_FIND_DATA` structure, which is the underlying data type for `directory_entry`, contains the file size as one of the fields. Thus efficient enumeration of files and getting their sizes is possible without doing a separate query for the file size.

[17 Jun 2014 Rapperswil LWG will investigate issue at a subsequent meeting.]

[23 Nov 2015 Editorally correct name of data structure mentioned in discussion.]

[Mar 2016 Jacksonville Beman to provide paper about this]

[Apr 2016 Issue updated to address the C++ Working Paper. Previously addressed File System TS]

Previous resolution [SUPERSEDED]

> In [fs.class.directory_entry] Class `directory_entry` add the following observer declarations:

> >           uintmax_t file_size();
> >           uintmax_t file_size(error_code& ec) noexcept;

> In `directory_entry` observers 29.12.10.4 [fs.dir.entry.obs] add the following:

> >           uintmax_t file_size();
> >           uintmax_t file_size(error_code& ec) noexcept;

> > > Returns: if `*this` contains a cached file size, return it. Otherwise return `file_size(path())` or `file_size(path(), ec)` respectively.

> > > Throws: As specified in Error reporting (7).

[2016-08, Beman comments]

This will be resolved by P0317R1, Directory Entry Caching for Filesystem.

Fri AM: Moved to Tentatively Resolved

Proposed resolution: