operator<<,>>(std::filesystem::path)
Min standard notice:
Performs stream input or output on the path p. std::quoted is used so that spaces do not cause truncation when later read by stream input operator.
# Declarations
template< class CharT, class Traits >
friend std::basic_ostream<CharT,Traits>&
operator<<( std::basic_ostream<CharT,Traits>& os, const path& p );
(since C++17)
template< class CharT, class Traits >
friend std::basic_istream<CharT,Traits>&
operator>>( std::basic_istream<CharT,Traits>& is, path& p );
(since C++17)
# Parameters
os: stream to perform output onis: stream to perform input onp: path to insert or extract
# Example
#include <filesystem>
#include <iostream>
int main()
{
std::cout << std::filesystem::current_path() << '\n';
std::cout << std::filesystem::temp_directory_path() << '\n';
}
# Defect reports
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2989 | C++17 | allowed insertion of everything convertible to path in the presence of a using-directive | made hidden friend |