# operator-(std::basic_const_iterator)

> C++ Atlas: `cppatlas.com/w/cpp/iterator/basic_const_iterator/operator-` | Source: https://en.cppreference.com/w/cpp/iterator/basic_const_iterator/operator- | Domain: Iterator | Standards: C++23

Returns the distance between basic_const_iterator and its sentinel.

## Official Specification Summary (cppreference)

```cpp
template< std::sized_sentinel_for<Iter> S >
constexpr difference_type operator-( const S& s ) const; // (1) (since C++23)

template< /*not-a-const-iterator*/ S >
    requires std::sized_sentinel_for<S, Iter>
friend constexpr difference_type
    operator-( const S& s, const basic_const_iterator& i ); // (2) (since C++23)
```

Returns the distance between `basic_const_iterator` and its sentinel.

`S` satisfies the exposition-only concept `/*not-a-const-iterator*/` if and only if it's not a specialization of `basic_const_iterator`.

### Parameters

- `i, s` - iterator and sentinel to compute the difference of

### Return value

1) `base() - s`

2) `s - i.base()`

### Example

> Note: This section is incomplete Reason: no example

---
Attribution: content from https://en.cppreference.com/w/cpp/iterator/basic_const_iterator/operator- (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.