- Home
- Skills
- Copyleftdev
- Sk1llz
- Stepanov
stepanov_skill
- Python
3
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill copyleftdev/sk1llz --skill stepanov- SKILL.md7.8 KB
Overview
This skill encodes Alexander Stepanov's generic programming principles for designing C++ algorithms and types. It emphasizes putting algorithms first, expressing minimal requirements as concepts, and using iterators/ranges to separate algorithms from containers. The result is reusable, mathematically grounded code that composes cleanly across types.
How this skill works
I inspect algorithm designs and API surfaces and translate them into minimal template requirements, iterator categories, and regular-type contracts. I recommend iterator-pair and range overloads, document complexity and algebraic properties, and show how to implement iterators, algorithms, and compositions that follow Stepanov's patterns. I also suggest modern updates such as C++20 ranges and concepts.
When to use it
- Designing reusable algorithms intended to work across many container types
- Writing new container types that must interoperate with standard algorithms
- Refactoring code that currently couples algorithms to concrete containers
- Documenting template requirements and complexity guarantees
- Adopting C++20 ranges and concepts in existing codebases
Best practices
- Design algorithms first; derive the minimal concept requirements for template parameters
- Express requirements explicitly using concepts or clear documentation (iterator category, value semantics)
- Favor iterator-pair and range overloads, and prefer half-open ranges [first, last)
- Make user types regular: default-constructible, copyable, assignable, and comparable where appropriate
- Compose complex operations from simple, well-documented algorithms instead of monoliths
Example use cases
- Implementing a new sort or search algorithm that must work on any random-access iterator
- Creating a linked-list with a standards-compliant forward iterator and iterator_traits
- Refactoring container-specific utilities into iterator-based algorithms and range adapters
- Documenting template libraries with precise complexity and algebraic property statements
- Migrating legacy algorithms to C++20 ranges and adding concept-based constraints
FAQ
Identify the traversal and operation needs: single-pass read means InputIterator, multi-pass needs ForwardIterator, bidirectional traversal needs BidirectionalIterator, and indexed access needs RandomAccessIterator.
When should I prefer ranges over iterator pairs?
Prefer iterator pairs for low-level generic algorithms and ranges for expressive, composable pipelines—use both by providing overloads when practical.