operator==,!=,<,<=,>,>=,<=> (std::filesystem::path)
|
friend
bool
operator
==
(
const
path
&
lhs,
const
path
&
rhs
)
noexcept
;
|
(1) | (C++17以降) |
|
friend
bool
operator
!
=
(
const
path
&
lhs,
const
path
&
rhs
)
noexcept
;
|
(2) |
(C++17以降)
(C++20まで) |
|
friend
bool
operator
<
(
const
path
&
lhs,
const
path
&
rhs
)
noexcept
;
|
(3) |
(C++17以降)
(C++20まで) |
|
friend
bool
operator
<=
(
const
path
&
lhs,
const
path
&
rhs
)
noexcept
;
|
(4) |
(C++17以降)
(C++20まで) |
|
friend
bool
operator
>
(
const
path
&
lhs,
const
path
&
rhs
)
noexcept
;
|
(5) |
(C++17以降)
(C++20まで) |
|
friend
bool
operator
>=
(
const
path
&
lhs,
const
path
&
rhs
)
noexcept
;
|
(6) |
(C++17以降)
(C++20まで) |
|
friend
std::
strong_ordering
operator <=> ( const path & lhs, const path & rhs ) noexcept ; |
(7) | (C++20以降) |
2つのパスを辞書順に比較します。
これらの関数は通常の unqualified lookup や qualified lookup では可視化されず、 argument-dependent lookup によってのみ、std::filesystem::pathが引数の関連クラスである場合に見つけることができます。これは using namespace std :: filesystem ; using-directive が存在する場合の望ましくない変換を防ぎます。
|
|
(C++20以降) |
目次 |
パラメータ
| lhs, rhs | - | 比較するパス |
戻り値
lhs
が
rhs
より小さい場合、そうでなければ
std
::
strong_ordering
::
greater
rhs
が
lhs
より小さい場合、そうでなければ
std
::
strong_ordering
::
equal
を返す。
注記
パスの等価性と同値性は異なるセマンティクスを持ちます。
等価性の場合、
operator==
によって決定されるように、字句表現のみが比較されます。したがって、
path
(
"a"
)
==
path
(
"b"
)
が
true
になることは決してありません。
等価性の場合、 std::filesystem::equivalent() によって決定されるように、2つのパスが同じファイルシステムオブジェクトに 解決される かどうかがチェックされます。したがって equivalent ( "a" , "b" ) は、パスが同じファイルに解決される場合に true を返します。
例
|
このセクションは不完全です
理由: 例がありません |
不具合報告
以下の動作変更欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。
| DR | 適用対象 | 公開時の動作 | 正しい動作 |
|---|---|---|---|
| LWG 3065 | C++17 |
using-directive
が存在する場合、
path
に変換可能なすべての比較を許可していた
|
隠れフレンド関数に変更 |
関連項目
|
2つのパスの字句表現を辞書順に比較する
(公開メンバ関数) |
|
|
(C++17)
|
2つのパスが同じファイルシステムオブジェクトを参照しているかチェックする
(関数) |