JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
Loading...
Searching...
No Matches
jh::iterator< Container > Struct Template Reference

Forward declaration of jh::iterator<Container>. More...

Detailed Description

template<typename Container>
struct jh::iterator< Container >

Forward declaration of jh::iterator<Container>.

This template provides a non-intrusive declaration point for assigning an iterator type to third-party containers that cannot be modified directly. By declaring a specialization of jh::iterator<Container>, a library or user may "claim" the iterator type of an external container before any other deduction mechanisms are applied.

In addition to supporting non-intrusive iterator assignment, this template also serves as an optional mechanism for defining a container's iterator outside the container's class definition. A specialization may provide a nested type that represents the iterator implementation.

The iterator selection system evaluates possible sources in a fixed order. The presence of a valid jh::iterator<Container>::type always takes precedence over all other forms of deduction. The resolution sequence is:

  1. If jh::iterator<Container>::type exists and satisfies jh::is_iterator, it is selected.
  2. If Container::iterator exists and satisfies jh::is_iterator, it is selected.
  3. If begin() is available and its return type satisfies jh::is_iterator, that return type is selected.
  4. If Container is a pointer type, the pointer itself is used as the iterator.
  5. If Container is an array type, its decayed pointer is used as the iterator.

This declaration does not impose any structure on the iterator; it merely provides the entry point for specializations. Containers remain free to define their iterators internally, externally, or not at all, relying on fallback deduction where appropriate.

Template Parameters
ContainerThe container or range type for which an iterator specialization may be declared.

The documentation for this struct was generated from the following file: