Skip to content

Commit

Permalink
Remove unused IterConcept from iterator_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickroberts committed Feb 8, 2025
1 parent 75a090b commit 76932a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
5 changes: 2 additions & 3 deletions include/beman/any_view/detail/iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ class iterator {
static constexpr bool random_access = std::derived_from<IterConceptT, std::random_access_iterator_tag>;
static constexpr bool contiguous = std::derived_from<IterConceptT, std::contiguous_iterator_tag>;

using interface_type = iterator_interface<IterConceptT, ElementT, RefT, RValueRefT, DiffT>;
using interface_type = iterator_interface<ElementT, RefT, RValueRefT, DiffT>;
// inplace storage sufficient for a vtable pointer and two pointers
intrusive_small_ptr<interface_type, 3 * sizeof(void*)> iterator_ptr;

template <class IteratorT, class SentinelT>
using adaptor_type =
detail::iterator_adaptor<IterConceptT, ElementT, reference, rvalue_reference, DiffT, IteratorT, SentinelT>;
using adaptor_type = detail::iterator_adaptor<ElementT, reference, rvalue_reference, DiffT, IteratorT, SentinelT>;

template <class IteratorT, class SentinelT>
static constexpr auto get_noexcept() {
Expand Down
15 changes: 7 additions & 8 deletions include/beman/any_view/detail/iterator_adaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,27 @@

namespace beman::any_view::detail {

template <class IterConceptT,
class ElementT,
template <class ElementT,
class RefT,
class RValueRefT,
class DiffT,
std::input_or_output_iterator IteratorT,
std::sentinel_for<IteratorT> SentinelT>
class iterator_adaptor : public iterator_interface<IterConceptT, ElementT, RefT, RValueRefT, DiffT> {
class iterator_adaptor : public iterator_interface<ElementT, RefT, RValueRefT, DiffT> {
[[no_unique_address]] IteratorT iterator;
[[no_unique_address]] SentinelT sentinel;

using iterator_interface = detail::iterator_interface<IterConceptT, ElementT, RefT, RValueRefT, DiffT>;
using iterator_interface = detail::iterator_interface<ElementT, RefT, RValueRefT, DiffT>;
using pointer = std::add_pointer_t<RefT>;

static constexpr auto get_noexcept() {
return std::is_nothrow_move_constructible_v<IteratorT> and std::is_nothrow_move_constructible_v<SentinelT>;
}

static constexpr bool forward = std::derived_from<IterConceptT, std::forward_iterator_tag>;
static constexpr bool bidirectional = std::derived_from<IterConceptT, std::bidirectional_iterator_tag>;
static constexpr bool random_access = std::derived_from<IterConceptT, std::random_access_iterator_tag>;
static constexpr bool contiguous = std::derived_from<IterConceptT, std::contiguous_iterator_tag>;
static constexpr bool forward = std::forward_iterator<IteratorT>;
static constexpr bool bidirectional = std::bidirectional_iterator<IteratorT>;
static constexpr bool random_access = std::random_access_iterator<IteratorT>;
static constexpr bool contiguous = std::contiguous_iterator<IteratorT>;

static constexpr auto down_cast(const iterator_interface& other) {
return dynamic_cast<const iterator_adaptor*>(std::addressof(other));
Expand Down
2 changes: 1 addition & 1 deletion include/beman/any_view/detail/iterator_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace beman::any_view::detail {

template <class IterConceptT, class ElementT, class RefT, class RValueRefT, class DiffT>
template <class ElementT, class RefT, class RValueRefT, class DiffT>
class iterator_interface {
using pointer = std::add_pointer_t<RefT>;

Expand Down

0 comments on commit 76932a0

Please sign in to comment.