[libc++] Implement `operator==` for `filesystem::space_info`
Implements part of P1614R2 "The Mothership has Landed" Differential Revision: https://reviews.llvm.org/D130861
This commit is contained in:
parent
95b3ff08f5
commit
706b3951b3
|
@ -74,7 +74,7 @@ Section,Description,Dependencies,Assignee,Complete
|
||||||
| `[time.zone.link.nonmembers] <https://wg21.link/time.zone.link.nonmembers>`_","| chrono::time_zone
|
| `[time.zone.link.nonmembers] <https://wg21.link/time.zone.link.nonmembers>`_","| chrono::time_zone
|
||||||
| chrono::leap_second
|
| chrono::leap_second
|
||||||
| chrono::time_zone_link",A ``<chrono>`` implementation,Unassigned,|Not Started|
|
| chrono::time_zone_link",A ``<chrono>`` implementation,Unassigned,|Not Started|
|
||||||
| `[fs.filesystem.syn] <https://wg21.link/fs.filesystem.syn>`_,| `filesystem::space_info <https://reviews.llvm.org/D130861>`_,None,Adrian Vogelsgesang,|In Progress|
|
| `[fs.filesystem.syn] <https://wg21.link/fs.filesystem.syn>`_,| `filesystem::space_info <https://reviews.llvm.org/D130861>`_,None,Adrian Vogelsgesang,|Complete|
|
||||||
| `[fs.path.nonmember] <https://wg21.link/fs.path.nonmember>`_,| `filesystem::path <https://reviews.llvm.org/D130859>`_,None,Adrian Vogelsgesang,|In Progress|
|
| `[fs.path.nonmember] <https://wg21.link/fs.path.nonmember>`_,| `filesystem::path <https://reviews.llvm.org/D130859>`_,None,Adrian Vogelsgesang,|In Progress|
|
||||||
| `[fs.dir.entry.obs] <https://wg21.link/fs.dir.entry.obs>`_,| `filesystem::directory_entry <https://reviews.llvm.org/D130860>`_,None,Adrian Vogelsgesang,|In Progress|
|
| `[fs.dir.entry.obs] <https://wg21.link/fs.dir.entry.obs>`_,| `filesystem::directory_entry <https://reviews.llvm.org/D130860>`_,None,Adrian Vogelsgesang,|In Progress|
|
||||||
| `[re.submatch.op] <https://wg21.link/re.submatch.op>`_,| sub_match,None,Mark de Wever,|In Progress|
|
| `[re.submatch.op] <https://wg21.link/re.submatch.op>`_,| sub_match,None,Mark de Wever,|In Progress|
|
||||||
|
|
|
|
@ -28,6 +28,10 @@ struct _LIBCPP_TYPE_VIS space_info {
|
||||||
uintmax_t capacity;
|
uintmax_t capacity;
|
||||||
uintmax_t free;
|
uintmax_t free;
|
||||||
uintmax_t available;
|
uintmax_t available;
|
||||||
|
|
||||||
|
# if _LIBCPP_STD_VER > 17
|
||||||
|
friend _LIBCPP_HIDE_FROM_ABI bool operator==(const space_info&, const space_info&) = default;
|
||||||
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||||
|
|
|
@ -64,6 +64,8 @@
|
||||||
uintmax_t capacity;
|
uintmax_t capacity;
|
||||||
uintmax_t free;
|
uintmax_t free;
|
||||||
uintmax_t available;
|
uintmax_t available;
|
||||||
|
|
||||||
|
friend bool operator==(const space_info&, const space_info&) = default; // C++20
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class file_type;
|
enum class file_type;
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
||||||
|
|
||||||
|
// <filesystem>
|
||||||
|
|
||||||
|
// friend bool operator==(const space_info&, const space_info&);
|
||||||
|
|
||||||
|
#include "filesystem_include.h"
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
#include "test_comparisons.h"
|
||||||
|
|
||||||
|
using namespace fs;
|
||||||
|
|
||||||
|
constexpr bool test() {
|
||||||
|
assert(testEquality(space_info{1, 2, 3}, space_info{1, 2, 3}, true));
|
||||||
|
assert(testEquality(space_info{0, 2, 3}, space_info{1, 2, 3}, false));
|
||||||
|
assert(testEquality(space_info{1, 0, 3}, space_info{1, 2, 3}, false));
|
||||||
|
assert(testEquality(space_info{1, 2, 0}, space_info{1, 2, 3}, false));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int, char**) {
|
||||||
|
using space_info = std::filesystem::space_info;
|
||||||
|
|
||||||
|
AssertEqualityAreNoexcept<space_info>();
|
||||||
|
AssertEqualityReturnBool<space_info>();
|
||||||
|
|
||||||
|
test();
|
||||||
|
static_assert(test());
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue