Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STL Adapters

Русская версия

C++23 CMake License: MIT

Header-only C++23 pipeline library with lazy adapters for data processing — filter, transform, split, join, and file I/O, composed via |. Written as part of a C++ course at ITMO University.

Adapters are lazy by default (except AggregateByKey, Join, and SplitExpected).

Dir("./data", /*recursive=*/false)
  | Filter([](fs::path& p){ return p.extension() == ".txt"; })
  | OpenFiles()
  | Split("\n ,.;")
  | Out(std::cout);

Adapters

Adapter Description
Dir(path, recursive) files in a directory, optionally recursive
OpenFiles() opens each path as a file stream, yields lines
Split(delimiters) splits strings by a set of delimiter characters
Filter(pred) filters elements by predicate
Transform(func) applies a function to each element
AsDataFlow(vec) wraps a std::vector into a stream
Out(ostream) prints elements to a stream (terminal)
Write(ostream, delim) same, but with a custom delimiter between elements (terminal)
AsVector() collects stream into a std::vector (terminal)
Join(right, lkey, rkey) LEFT JOIN of two streams by key
DropNullopt() filters std::nullopt from an optional<T> stream
SplitExpected() splits an expected<T,E> stream into values and errors
AggregateByKey(init, agg, key) aggregates values by key via an accumulator function

Build

git clone https://github.com/notakeith/stl-adapters.git
cd stl-adapters
cmake -B build && cmake --build build
ctest --test-dir build

Requirements: CMake ≥ 3.12, GCC 13+ or Clang 17+.

About

Header-only C++23 pipeline library with lazy adapters for data processing — filter, transform, split, join, and file I/O, composed via |.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages