@@ -202,10 +202,11 @@ class ABSL_ATTRIBUTE_VIEW Span {
202
202
public:
203
203
using element_type = T;
204
204
using value_type = absl::remove_cv_t <T>;
205
- // TODO(b/316099902) - pointer should be Nullable<T*>, but this makes it hard
206
- // to recognize foreach loops as safe.
207
- using pointer = T*;
208
- using const_pointer = const T*;
205
+ // TODO(b/316099902) - pointer should be absl_nullable, but this makes it hard
206
+ // to recognize foreach loops as safe. absl_nullability_unknown is currently
207
+ // used to suppress -Wnullability-completeness warnings.
208
+ using pointer = T* absl_nullability_unknown;
209
+ using const_pointer = const T* absl_nullability_unknown;
209
210
using reference = T&;
210
211
using const_reference = const T&;
211
212
using iterator = pointer;
@@ -220,7 +221,7 @@ class ABSL_ATTRIBUTE_VIEW Span {
220
221
static const size_type npos = ~(size_type(0 ));
221
222
222
223
constexpr Span () noexcept : Span(nullptr , 0 ) {}
223
- constexpr Span (pointer absl_nullable array ABSL_ATTRIBUTE_LIFETIME_BOUND,
224
+ constexpr Span (pointer array ABSL_ATTRIBUTE_LIFETIME_BOUND,
224
225
size_type length) noexcept
225
226
: ptr_(array), len_(length) {}
226
227
@@ -310,7 +311,7 @@ class ABSL_ATTRIBUTE_VIEW Span {
310
311
//
311
312
// Returns a pointer to the span's underlying array of data (which is held
312
313
// outside the span).
313
- constexpr pointer absl_nullable data () const noexcept { return ptr_; }
314
+ constexpr pointer data () const noexcept { return ptr_; }
314
315
315
316
// Span::size()
316
317
//
@@ -368,31 +369,27 @@ class ABSL_ATTRIBUTE_VIEW Span {
368
369
//
369
370
// Returns an iterator pointing to the first element of this span, or `end()`
370
371
// if the span is empty.
371
- constexpr iterator absl_nullable begin () const noexcept { return data (); }
372
+ constexpr iterator begin () const noexcept { return data (); }
372
373
373
374
// Span::cbegin()
374
375
//
375
376
// Returns a const iterator pointing to the first element of this span, or
376
377
// `end()` if the span is empty.
377
- constexpr const_iterator absl_nullable cbegin () const noexcept {
378
- return begin ();
379
- }
378
+ constexpr const_iterator cbegin () const noexcept { return begin (); }
380
379
381
380
// Span::end()
382
381
//
383
382
// Returns an iterator pointing just beyond the last element at the
384
383
// end of this span. This iterator acts as a placeholder; attempting to
385
384
// access it results in undefined behavior.
386
- constexpr iterator absl_nullable end () const noexcept {
387
- return data () + size ();
388
- }
385
+ constexpr iterator end () const noexcept { return data () + size (); }
389
386
390
387
// Span::cend()
391
388
//
392
389
// Returns a const iterator pointing just beyond the last element at the
393
390
// end of this span. This iterator acts as a placeholder; attempting to
394
391
// access it results in undefined behavior.
395
- constexpr const_iterator absl_nullable cend () const noexcept { return end (); }
392
+ constexpr const_iterator cend () const noexcept { return end (); }
396
393
397
394
// Span::rbegin()
398
395
//
@@ -507,7 +504,7 @@ class ABSL_ATTRIBUTE_VIEW Span {
507
504
}
508
505
509
506
private:
510
- pointer absl_nullable ptr_;
507
+ pointer ptr_;
511
508
size_type len_;
512
509
};
513
510
0 commit comments