Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions include/tmp/file
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ public:
/// @returns The underlying implementation-defined handle
native_handle_type native_handle() const noexcept;

/// Returns pointer to the underlying raw file device object
/// @returns A pointer to the underlying raw file device
std::filebuf* rdbuf() const noexcept;

/// Moves the managed file to a given target, releasing
/// ownership of the managed file; behaves like `std::filesystem::rename`
/// even when moving between filesystems
Expand Down
4 changes: 0 additions & 4 deletions src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ file::native_handle_type file::native_handle() const noexcept {
return sb.native_handle();
}

std::filebuf* file::rdbuf() const noexcept {
return const_cast<filebuf*>(std::addressof(sb)); // NOLINT(*-const-cast)
}

void file::move(const fs::path& to) {
sb.close();

Expand Down
3 changes: 2 additions & 1 deletion tests/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ namespace fs = std::filesystem;

/// Returns whether the underlying raw file device object is open
bool is_open(const file& file) {
return file.rdbuf()->is_open();
std::filebuf* filebuf = dynamic_cast<std::filebuf*>(file.rdbuf());
return filebuf != nullptr && filebuf->is_open();
}

/// Checks if the given file handle is valid
Expand Down
Loading