2020-02-19 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/span (span::const_iterator, span::const_reverse_iterator)
+ (span::cbegin(), span::cend(), span::crbegin(), span::crend()):
+ Remove (LWG 3320).
+ * testsuite/23_containers/span/everything.cc: Replace uses of cbegin
+ and cend.
+ * testsuite/20_util/specialized_algorithms/destroy/constrained.cc:
+ Likewise.
+ * testsuite/20_util/specialized_algorithms/uninitialized_copy/
+ constrained.cc: Likewise.
+ * testsuite/20_util/specialized_algorithms/
+ uninitialized_default_construct/constrained.cc: Likewise.
+ * testsuite/20_util/specialized_algorithms/uninitialized_fill/
+ constrained.cc: Likewise.
+ * testsuite/20_util/specialized_algorithms/uninitialized_move/
+ constrained.cc: Likewise.
+ * testsuite/20_util/specialized_algorithms/
+ uninitialized_value_construct/constrained.cc: Likewise.
+
* include/bits/range_access.h (range_size_t): Define alias template.
* include/std/ranges (all_view): Rename to views::all_t (LWG 3335).
* testsuite/std/ranges/adaptors/filter.cc: Adjust to new name.
using reference = element_type&;
using const_reference = const element_type&;
using iterator = __gnu_cxx::__normal_iterator<pointer, span>;
- using const_iterator = __gnu_cxx::__normal_iterator<const_pointer, span>;
using reverse_iterator = std::reverse_iterator<iterator>;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
// member constants
static constexpr size_t extent = _Extent;
begin() const noexcept
{ return iterator(this->_M_ptr); }
- constexpr const_iterator
- cbegin() const noexcept
- { return const_iterator(this->_M_ptr); }
-
constexpr iterator
end() const noexcept
{ return iterator(this->_M_ptr + this->size()); }
- constexpr const_iterator
- cend() const noexcept
- { return const_iterator(this->_M_ptr + this->size()); }
-
constexpr reverse_iterator
rbegin() const noexcept
{ return reverse_iterator(this->end()); }
- constexpr const_reverse_iterator
- crbegin() const noexcept
- { return const_reverse_iterator(this->cend()); }
-
constexpr reverse_iterator
rend() const noexcept
{ return reverse_iterator(this->begin()); }
- constexpr const_reverse_iterator
- crend() const noexcept
- { return const_reverse_iterator(this->cbegin()); }
-
// subviews
template<size_t _Count>
ranges::uninitialized_default_construct(rx);
VERIFY( X::count == size );
- auto i = rx.cbegin();
+ auto i = rx.begin();
if (k == 0)
i = ranges::destroy(rx);
else if (k == 1)
else
__builtin_abort();
- VERIFY( i == rx.cend() );
+ VERIFY( i == rx.end() );
VERIFY( X::count == 0 );
}
}
auto buffer = std::unique_ptr<char[]>(new char[sizeof(T)*size]);
std::span<T> rx((T *)buffer.get(), size);
- ranges::uninitialized_copy_result res = {ix.cbegin(), rx.cbegin()};
+ ranges::uninitialized_copy_result res = {ix.begin(), rx.begin()};
if (k == 0)
res = ranges::uninitialized_copy(ix.begin(), ix.end(),
rx.begin(), rx.end());
rx.begin(), rx.end());
else if (k == 3)
res = ranges::uninitialized_copy(ix.begin(), ix.end(),
- rx.cbegin(), rx.cend());
+ rx.begin(), rx.end());
else if (k == 4)
res = ranges::uninitialized_copy(ix, std::as_const(rx));
else if (k == 5)
res = ranges::uninitialized_copy_n(ix.begin(), size,
- rx.cbegin(), rx.cend());
+ rx.begin(), rx.end());
else if (k == 6)
res = ranges::uninitialized_copy_n(ix.begin(), size/2,
- rx.cbegin(), rx.cend());
+ rx.begin(), rx.end());
else if (k == 7)
res = ranges::uninitialized_copy_n(ix.begin(), size,
- rx.cbegin(), rx.cbegin()+size/2);
+ rx.begin(), rx.begin()+size/2);
else
__builtin_abort();
if (k == 6 || k == 7)
{
- VERIFY( ranges::distance(ix.cbegin(), res.in) == size/2 );
- VERIFY( ranges::distance(rx.cbegin(), res.out) == size/2 );
+ VERIFY( ranges::distance(ix.begin(), res.in) == size/2 );
+ VERIFY( ranges::distance(rx.begin(), res.out) == size/2 );
VERIFY( ranges::equal(ix.begin(), ix.begin()+size/2,
rx.begin(), rx.begin()+size/2) );
ranges::destroy(rx.begin(), rx.begin()+size/2);
}
else
{
- VERIFY( res.in == ix.cend() );
- VERIFY( res.out == rx.cend() );
+ VERIFY( res.in == ix.end() );
+ VERIFY( res.out == rx.end() );
VERIFY( ranges::equal(ix, rx) );
ranges::destroy(rx);
}
ranges::fill(rx, t);
}
- auto i = rx.cbegin();
+ auto i = rx.begin();
if (k == 0)
i = ranges::uninitialized_default_construct(rx.begin(), rx.end());
else if (k == 1)
else if constexpr (std::is_fundamental_v<T>)
continue;
else if (k == 3)
- i = ranges::uninitialized_default_construct(rx.cbegin(), rx.cend());
+ i = ranges::uninitialized_default_construct(rx.begin(), rx.end());
else if (k == 4)
i = ranges::uninitialized_default_construct(std::as_const(rx));
else if (k == 5)
- i = ranges::uninitialized_default_construct_n(rx.cbegin(), 1024);
+ i = ranges::uninitialized_default_construct_n(rx.begin(), 1024);
else
__builtin_abort();
- VERIFY( i == rx.cend() );
+ VERIFY( i == rx.end() );
VERIFY( ranges::find_if(rx, [&t](const T& v) { return t != v; }) == i );
ranges::destroy(rx);
auto buffer = std::unique_ptr<char[]>(new char[sizeof(T)*size]);
std::span<T> rx((T *)buffer.get(), size);
- auto i = rx.cbegin();
+ auto i = rx.begin();
if (k == 0)
i = ranges::uninitialized_fill(rx.begin(), rx.end(), value);
else if (k == 1)
else if (k == 2)
i = ranges::uninitialized_fill_n(rx.begin(), 1024, value);
else if (k == 3)
- i = ranges::uninitialized_fill(rx.cbegin(), rx.cend(), value);
+ i = ranges::uninitialized_fill(rx.begin(), rx.end(), value);
else if (k == 4)
i = ranges::uninitialized_fill(std::as_const(rx), value);
else if (k == 5)
- i = ranges::uninitialized_fill_n(rx.cbegin(), 1024, value);
+ i = ranges::uninitialized_fill_n(rx.begin(), 1024, value);
else
__builtin_abort();
- VERIFY( i == rx.cend() );
+ VERIFY( i == rx.end() );
VERIFY( ranges::find_if(rx, [&value](const T& v) { return value != v; }) == i );
ranges::destroy(rx);
auto buffer = std::unique_ptr<char[]>(new char[sizeof(T)*size]);
std::span<T> rx((T *)buffer.get(), size);
- ranges::uninitialized_move_result res = {ix.cbegin(), rx.cbegin()};
+ ranges::uninitialized_move_result res = {ix.begin(), rx.begin()};
if (k == 0)
res = ranges::uninitialized_move(ix.begin(), ix.end(),
rx.begin(), rx.end());
rx.begin(), rx.end());
else if (k == 3)
res = ranges::uninitialized_move(ix.begin(), ix.end(),
- rx.cbegin(), rx.cend());
+ rx.begin(), rx.end());
else if (k == 4)
res = ranges::uninitialized_move(ix, std::as_const(rx));
else if (k == 5)
res = ranges::uninitialized_move_n(ix.begin(), size,
- rx.cbegin(), rx.cend());
+ rx.begin(), rx.end());
else if (k == 6)
res = ranges::uninitialized_move_n(ix.begin(), size/2,
- rx.cbegin(), rx.cend());
+ rx.begin(), rx.end());
else if (k == 7)
res = ranges::uninitialized_move_n(ix.begin(), size,
- rx.cbegin(), rx.cbegin()+size/2);
+ rx.begin(), rx.begin()+size/2);
else
__builtin_abort();
if (k == 6 || k == 7)
{
- VERIFY( ranges::distance(ix.cbegin(), res.in) == size/2 );
- VERIFY( ranges::distance(rx.cbegin(), res.out) == size/2 );
+ VERIFY( ranges::distance(ix.begin(), res.in) == size/2 );
+ VERIFY( ranges::distance(rx.begin(), res.out) == size/2 );
VERIFY( ranges::equal(saved_ix.begin(), saved_ix.begin()+size/2,
rx.begin(), rx.begin()+size/2) );
ranges::destroy(rx.begin(), rx.begin()+size/2);
}
else
{
- VERIFY( res.in == ix.cend() );
- VERIFY( res.out == rx.cend() );
+ VERIFY( res.in == ix.end() );
+ VERIFY( res.out == rx.end() );
VERIFY( ranges::equal(saved_ix, rx) );
ranges::destroy(rx);
}
T t{};
- auto i = rx.cbegin();
+ auto i = rx.begin();
if (k == 0)
i = ranges::uninitialized_value_construct(rx.begin(), rx.end());
else if (k == 1)
else if (k == 2)
i = ranges::uninitialized_value_construct_n(rx.begin(), 1024);
else if (k == 3)
- i = ranges::uninitialized_value_construct(rx.cbegin(), rx.cend());
+ i = ranges::uninitialized_value_construct(rx.begin(), rx.end());
else if (k == 4)
i = ranges::uninitialized_value_construct(std::as_const(rx));
else if (k == 5)
- i = ranges::uninitialized_value_construct_n(rx.cbegin(), 1024);
+ i = ranges::uninitialized_value_construct_n(rx.begin(), 1024);
else
__builtin_abort();
- VERIFY( i == rx.cend() );
+ VERIFY( i == rx.end() );
VERIFY( ranges::find_if(rx, [&t](const T& v) { return t != v; }) == i );
ranges::destroy(rx);
bool really_empty1 = std::empty(shorts);
bool really_empty2 = shorts.data() == nullptr;
bool really_empty3 = shorts.begin() == shorts.end();
- bool really_empty4 = shorts.cbegin() == shorts.cend();
bool really_empty =
- really_empty0 && really_empty1 && really_empty2 && really_empty3 && really_empty4;
+ really_empty0 && really_empty1 && really_empty2 && really_empty3;
(void)really_empty;
VERIFY(really_empty);
std::span<const std::byte> muh_byte_span = std::as_bytes(muh_span);
std::span<std::byte> muh_mutable_byte_span = std::as_writable_bytes(muh_span);
std::span<std::byte> muh_original_byte_span(original_bytes, original_bytes + 4);
- bool definitely_reinterpret_casted0 = std::equal(muh_byte_span.cbegin(), muh_byte_span.cend(),
- muh_original_byte_span.cbegin(), muh_original_byte_span.cend());
- bool definitely_reinterpret_casted1 = std::equal(muh_mutable_byte_span.cbegin(),
- muh_mutable_byte_span.cend(), muh_original_byte_span.cbegin(), muh_original_byte_span.cend());
+ bool definitely_reinterpret_casted0 = std::equal(muh_byte_span.begin(), muh_byte_span.end(),
+ muh_original_byte_span.begin(), muh_original_byte_span.end());
+ bool definitely_reinterpret_casted1 = std::equal(muh_mutable_byte_span.begin(),
+ muh_mutable_byte_span.end(), muh_original_byte_span.begin(), muh_original_byte_span.end());
bool definitely_reinterpret_casted =
definitely_reinterpret_casted0 && definitely_reinterpret_casted1;
(void)definitely_reinterpret_casted;
std::span<std::byte> muh_original_byte_span_ptr_size(original_bytes, 4);
bool definitely_equivalent =
- std::equal(muh_original_byte_span_ptr_size.cbegin(), muh_original_byte_span_ptr_size.cend(),
- muh_original_byte_span.cbegin(), muh_original_byte_span.cend());
+ std::equal(muh_original_byte_span_ptr_size.begin(), muh_original_byte_span_ptr_size.end(),
+ muh_original_byte_span.begin(), muh_original_byte_span.end());
(void)definitely_equivalent;
VERIFY(definitely_equivalent);