|
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.
|
Unified deduction model for container element types. More...
#include <ranges>#include <type_traits>#include "jh/conceptual/iterator.h"#include "jh/conceptual/sequence.h"Go to the source code of this file.
Namespaces | |
| namespace | jh::concepts |
| Behavioral concept namespace of the JH Toolkit. | |
Concepts | |
| concept | jh::concepts::is_contiguous_reallocable |
| Concept that constrains types usable in contiguous, reallocating containers. | |
Typedefs | |
| template<typename C> | |
| using | jh::concepts::container_value_t = typename detail::container_value_type_impl<C>::type |
Deduce the value type of a container C. | |
Unified deduction model for container element types.
This header defines the trait jh::concepts::container_value_t, a unified and extensible mechanism for deducing the value type of arbitrary container-like types. It harmonizes three deduction strategies — user registration, declared value_type, and iterator-based inference — under a deterministic priority system.
Many standard and custom containers expose different or ambiguous value-type information. This trait provides a canonical, conflict-resolving method to obtain a single consistent element type used across the entire jh::concepts subsystem (e.g. in closable_container_for and collectable_container_for).
jh::container_deduction<C>::value_type — explicit registration always takes precedence. C::value_type — used if no override is present. iterator_t<C> and iterator_value_t<iterator_t<C>>. void — deduction failure. Custom containers can specialize jh::container_deduction<C> to explicitly define a value_type. This mechanism overrides all automatic deduction and provides a stable interface for third-party containers that do not follow standard iterator or value conventions.
std::ranges conventions while allowing user extension without ADL or traits injection. collect, to, and all range-concept meta-utilities. 1.3.x
2025