Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ah-dry-mixin.H File Reference

CRTP Mixins for container functionality (DRY principle). More...

#include <cstddef>
#include <tuple>
#include <functional>
#include <utility>
#include <type_traits>
#include <vector>
#include <string>
#include <ah-errors.H>
Include dependency graph for ah-dry-mixin.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Aleph::TraverseMixin< Derived, Type >
 CRTP Mixin providing traversal operations. More...
 
class  Aleph::LocateMixin< Derived, Type >
 CRTP Mixin providing element location operations. More...
 
class  Aleph::FunctionalMixin< Derived, Type >
 CRTP Mixin providing functional programming operations. More...
 
class  Aleph::KeysMixin< Derived, Type >
 CRTP Mixin for extracting keys from set-like containers. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 

Detailed Description

CRTP Mixins for container functionality (DRY principle).

This file provides CRTP (Curiously Recurring Template Pattern) mixin classes that implement common container operations. These mixins replace the macro-based approach in ahDry.H with properly documented, type-safe template classes.

Usage

To use these mixins, inherit from them using CRTP:

template <typename T>
class MyContainer : public TraverseMixin<MyContainer<T>, T>,
public FunctionalMixin<MyContainer<T>, T>,
public LocateMixin<MyContainer<T>, T>
{
// Your container implementation
// Must provide: get_it(), Iterator with has_curr(), get_curr(), next_ne()
};

Requirements

The derived class must provide:

  • Iterator nested type with:
    • has_curr() - returns true if iterator points to valid element
    • get_curr() - returns reference to current element
    • next_ne() - advances to next element (no exception version)
  • get_it() - returns an Iterator positioned at the first element
Author
Leandro Rabindranath León

Definition in file ah-dry-mixin.H.