1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi"). 10 #include <initializer_list> 19 template<
class Collection >
27 using Item = decltype( *std::begin( declval<Collection&>() ) );
39 Collection_iterator m_current;
43 void advance() { ++m_current; ++m_index; }
47 {
return {*m_current, m_index}; }
51 {
return a.m_current == b.m_current; }
61 {
return Iterator( std::begin( *m_p_collection ), 0 ); }
76 template<
class Collection >
81 template<
class Item >
Unref_< Item > Item_value
Some_type * P_
Creates a raw pointer type.
constexpr auto n_items_of(const Collection &c) noexcept -> Size
A drop-in replacement for bool without implicit conversion from/to types other than bool.
friend auto operator==(const Iterator &a, const Iterator &b) -> Truth
std::remove_reference_t< Some_reference_type > Unref_
Reduces a type T& or T&& to just T.
CPPX_DEFINE_TAG(Temporary)
Truth is a drop-in replacement for bool without implicit conversion from/to types other than bool.
CPPX_USE_STD(basic_string, basic_string_view, bitset, char_traits, size)
Enumerated_(tag::Temporary, Collection &&c)
$define_tag(NAME) defines NAME as a ~unique pointer type in namespace tag.
Size Index
Same as Size but with name signifying use as index.
auto operator *() const -> Item_and_index
Simple type builders Type_, P_, R_, Raw_array_ and Raw_array_of_.
Iterator(const Collection_iterator it, const Index i)
auto begin() const -> Iterator
decltype(begin(declval< Collection & >())) Iterator_for_
auto enumerated(Collection &c) -> Enumerated_< Collection >
auto end() const -> Iterator
Enumerated_(Collection &c)
decltype(*std::begin(declval< Collection & >())) Item