зеркало из https://github.com/microsoft/STL.git
Implement LWG-4035 single_view should provide empty (#4525)
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
This commit is contained in:
Родитель
e0a75b3537
Коммит
53f95ba92e
|
@ -1031,6 +1031,10 @@ namespace ranges {
|
|||
return data() + 1;
|
||||
}
|
||||
|
||||
_NODISCARD static constexpr bool empty() noexcept {
|
||||
return false;
|
||||
}
|
||||
|
||||
_NODISCARD static constexpr size_t size() noexcept {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,13 @@ constexpr bool test_one_type(T value, Args&&... args) {
|
|||
same_as<R> auto r0 = ranges::single_view{value};
|
||||
const R& cr0 = r0;
|
||||
|
||||
// validate member empty
|
||||
static_assert(same_as<decltype(R::empty()), bool>);
|
||||
static_assert(R::empty() == false);
|
||||
static_assert(noexcept(R::empty()));
|
||||
static_assert(noexcept(ranges::empty(r0)));
|
||||
static_assert(noexcept(ranges::empty(cr0)));
|
||||
|
||||
// validate member size
|
||||
static_assert(same_as<decltype(R::size()), size_t>);
|
||||
static_assert(R::size() == 1);
|
||||
|
|
Загрузка…
Ссылка в новой задаче