A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../ranges/../filesystem/path/operator_ltltgtgt.html below:

operator<<,>>(std::filesystem::path) - cppreference.com

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.

These function templates are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::filesystem::path is an associated class of the arguments. This prevents undesirable conversions in the presence of a using namespace std::filesystem; using-directive.

[edit] Parameters os - stream to perform output on is - stream to perform input on p - path to insert or extract [edit] Return value

1) os

2) is

[edit] Exceptions

May throw implementation-defined exceptions.

[edit] Possible implementation operator<<
template<class CharT, class Traits>
friend std::basic_ostream<CharT,Traits>&
    operator<<(std::basic_ostream<CharT,Traits>& os, const path& p)
{
    os << std::quoted(p.string<CharT,Traits>());
    return os;
}
operator>>
template<class CharT, class Traits>
friend std::basic_istream<CharT,Traits>&
    operator>>(std::basic_istream<CharT,Traits>& is, path& p)
{
    std::basic_string<CharT, Traits> t;
    is >> std::quoted(t);
    p = t;
    return is;
}
[edit] Example [edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4