{"id":37558890,"url":"https://github.com/hikarin522/fet","last_synced_at":"2026-01-16T09:04:06.712Z","repository":{"id":82178740,"uuid":"305577237","full_name":"hikarin522/fet","owner":"hikarin522","description":"C++ Interactive Extensions Library","archived":false,"fork":false,"pushed_at":"2025-07-26T13:44:42.000Z","size":56,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-26T17:24:18.768Z","etag":null,"topics":["cpp","cpp14"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hikarin522.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-10-20T03:17:47.000Z","updated_at":"2025-07-26T13:21:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"424d2458-272f-461d-888c-2fffd0b36a13","html_url":"https://github.com/hikarin522/fet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hikarin522/fet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hikarin522%2Ffet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hikarin522%2Ffet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hikarin522%2Ffet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hikarin522%2Ffet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hikarin522","download_url":"https://codeload.github.com/hikarin522/fet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hikarin522%2Ffet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp14"],"created_at":"2026-01-16T09:04:05.728Z","updated_at":"2026-01-16T09:04:06.703Z","avatar_url":"https://github.com/hikarin522.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fet\n\n**C++ Functional Extensions Library** - A LINQ-like library for C++ with pipe operator syntax\n\n[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)\n\n## Overview\n\n`fet` (Functional Extensions Library) is a header-only C++ library that provides LINQ-like functionality with a pipe operator syntax. It enables functional programming patterns for data processing pipelines using three core concepts:\n\n- **Source** (`ISource`): Data generators (similar to LINQ's `IEnumerable`)\n- **Gate** (`IGate`): Data transformers and filters (similar to LINQ's `Where`, `Select`)  \n- **Drain** (`IDrain`): Data consumers and aggregators (similar to LINQ's `ToList`, `Aggregate`)\n\n### Basic Syntax\n\n```cpp\nauto result = source | gate | gate | ... | drain;\n```\n\n### Type Combination Rules\n\n- `source | gate` → `source`\n- `gate | gate` → `gate`  \n- `gate | drain` → `drain`\n- `source | drain` → `decltype(drain.OnComplete())`\n\n## Requirements\n\n- C++14 compatible compiler\n- Header-only library - no compilation required\n- Note: Some examples may require additional implementation files not included in this repository\n\n## Installation\n\nSince `fet` is a header-only library, simply include the headers in your project:\n\n```cpp\n#include \"fet/core.hpp\"\n#include \"fet/source/container_source.hpp\"\n#include \"fet/gate/filter.hpp\"\n#include \"fet/gate/transform.hpp\"\n#include \"fet/drain/to_container.hpp\"\n// ... other components as needed\n```\n\n## Quick Start\n\n### Basic Example\n\n```cpp\n#include \u003cvector\u003e\n#include \u003ciostream\u003e\n#include \"fet/core.hpp\"\n#include \"fet/source/container_source.hpp\"\n#include \"fet/gate/filter.hpp\"\n#include \"fet/gate/transform.hpp\"\n#include \"fet/drain/to_container.hpp\"\n\nusing namespace fet;\n\nint main() {\n    std::vector\u003cint\u003e numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};\n    \n    auto result = from_container(numbers)\n        | filter([](int x) { return x % 2 == 0; })  // Filter even numbers\n        | transform([](int x) { return x * x; })     // Square each number\n        | to_vector();                               // Collect to vector\n    \n    // result contains: {4, 16, 36, 64, 100}\n    for (int value : result) {\n        std::cout \u003c\u003c value \u003c\u003c \" \";\n    }\n    return 0;\n}\n```\n\n## Core Components\n\n### Sources\n\nSources generate or provide data to the pipeline:\n\n#### Container Source\n```cpp\n#include \"fet/source/container_source.hpp\"\n\nstd::vector\u003cint\u003e data = {1, 2, 3, 4, 5};\nauto source = from_container(data);  // Creates a source from any container\n```\n\n#### Enumerator Source\n```cpp\n#include \"fet/source/enumerator_source.hpp\"\n\n// Generate sequence of numbers\nauto numbers = from_enumerator([](size_t i) { return i * 2; }, 5);  // {0, 2, 4, 6, 8}\n```\n\n### Gates (Transformers)\n\nGates transform, filter, or manipulate data as it flows through the pipeline:\n\n#### Filter\n```cpp\n#include \"fet/gate/filter.hpp\"\n\n// Filter elements based on a predicate\nauto evens = filter([](int x) { return x % 2 == 0; });\n\n// Filter out null pointers\nauto nonNull = filterNull();\n\n// Filter specific tuple element\nauto nonNullFirst = filterNull\u003c0\u003e();  // Filters std::get\u003c0\u003e != nullptr\n```\n\n#### Transform\n```cpp\n#include \"fet/gate/transform.hpp\"\n\n// Transform elements using a function\nauto squares = transform([](int x) { return x * x; });\n\n// Transform to different type\nauto strings = transform([](int x) { return std::to_string(x); });\n```\n\n#### Flat Map\n```cpp\n#include \"fet/gate/flat_map.hpp\"\n\n// Flatten nested containers\nauto words = std::vector\u003cstd::string\u003e{\"hello\", \"world\"};\nauto chars = from_container(words)\n    | flat_map([](const std::string\u0026 s) { return s; })  // Flatten to characters\n    | to_vector();\n```\n\n### Drains (Consumers)\n\nDrains consume the data and produce final results:\n\n#### To Container\n```cpp\n#include \"fet/drain/to_container.hpp\"\n\n// Collect to std::vector\nauto vec = source | to_vector();\n\n// Collect with transformation\nauto strings = source | to_vector([](int x) { return std::to_string(x); });\n```\n\n#### Accumulate\n```cpp\n#include \"fet/drain/accumulate.hpp\"\n\n// Sum all elements\nauto sum = source | accumulate(0, [](int acc, int x) { return acc + x; });\n\n// Custom accumulation\nauto product = source | accumulate(1, std::multiplies\u003cint\u003e{});\n```\n\n#### Multiplexer\n```cpp\n#include \"fet/drain/multiplexer.hpp\"\n// Split data to multiple destinations\n```\n\n## Advanced Usage\n\n### Chaining Multiple Operations\n\n```cpp\nauto result = from_container(data)\n    | filter([](int x) { return x \u003e 0; })        // Keep positive numbers\n    | transform([](int x) { return x * 2; })      // Double them\n    | filter([](int x) { return x \u003c 20; })       // Keep values \u003c 20\n    | transform([](int x) { return x + 1; })      // Add 1\n    | to_vector();                               // Collect results\n```\n\n### Working with Custom Types\n\n```cpp\nstruct Person {\n    std::string name;\n    int age;\n};\n\nstd::vector\u003cPerson\u003e people = {\n    {\"Alice\", 30}, {\"Bob\", 25}, {\"Charlie\", 35}\n};\n\nauto names = from_container(people)\n    | filter([](const Person\u0026 p) { return p.age \u003e= 30; })\n    | transform([](const Person\u0026 p) { return p.name; })\n    | to_vector();\n```\n\n### Performance Considerations\n\n- The library uses perfect forwarding and move semantics where possible\n- Operations are lazy and don't create intermediate containers\n- Memory is pre-allocated when container sizes are known\n\n## API Reference\n\n### Core Classes\n\n- `ISource`: Base class for data sources\n- `IGate`: Base class for data transformers\n- `IDrain`: Base class for data consumers\n- `SourceInfo\u003cT\u003e`: Contains metadata about data sources\n\n### Type Traits\n\n- `is_src\u003cT\u003e`: Check if type is a source\n- `is_gate\u003cT\u003e`: Check if type is a gate  \n- `is_drain\u003cT\u003e`: Check if type is a drain\n- `is_jct\u003cT\u003e`: Check if type is a junction (gate or drain)\n\n## License\n\nThis project is licensed under the Mozilla Public License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.\n\n## Compatibility\n\n- Designed for C++14 and later\n- Header-only implementation\n- Compatible with GCC, Clang, and MSVC compilers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhikarin522%2Ffet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhikarin522%2Ffet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhikarin522%2Ffet/lists"}