Console Library 8.0.0
A header-only library that makes C++ simple
Loading...
Searching...
No Matches
gextra.h File Reference

生成器库扩展功能。 More...

#include <chrono>
#include <cmath>
#include <cstdint>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <tuple>
#include "../core/sfinae.h"
#include "../util/params.h"
#include "./gen.h"

Go to the source code of this file.

Classes

class  console::gen::Random< T >
 随机数生成器,生成指定范围内的随机数。 More...
class  console::gen::FileLines
 文件行生成器,逐行读取文本文件。 More...
class  console::gen::FileChunks
 文件块生成器,按固定大小读取文件块。 More...
class  console::gen::Window< Gen >
 滑动窗口生成器,生成固定大小的滑动窗口。 More...
class  console::gen::Chunk< Gen >
 分块生成器,将元素按块分组。 More...
class  console::gen::Chain< Gen1, Gen2 >
 链式生成器,将两个生成器首尾连接。 More...
class  console::gen::StepBy< Gen >
 步进生成器,按指定步长跳过元素。 More...
class  console::gen::Debug< Gen >
 调试生成器,打印每个元素的值。 More...
class  console::gen::TakeUntil< Gen, Pred >
 取元素直到谓词成立(包含第一个满足条件的元素)。 More...
class  console::gen::DropUntil< Gen, Pred >
 跳过元素直到谓词成立(跳过第一个满足条件的元素)。 More...
class  console::gen::Pipeline< Op >
 单适配器管道特化。 More...
class  console::gen::Pipeline< Op, Rest... >
 多适配器管道特化。 More...
struct  console::gen::pipeline_t< Ops >
 管道适配器类,用于支持管道操作符。 More...
class  console::gen::Scan< Gen, T, BinaryOp >
class  console::gen::window_t
 窗口适配器(用于管道操作符)。 More...
class  console::gen::chunk_t
 分块适配器(用于管道操作符)。 More...
class  console::gen::step_by_t
 步进适配器(用于管道操作符)。 More...
class  console::gen::debug_t
 调试适配器(用于管道操作符)。 More...
class  console::gen::take_until_t< Pred >
 取元素直到谓词成立适配器(用于管道操作符)。 More...
class  console::gen::drop_until_t< Pred >
 跳过元素直到谓词成立适配器(用于管道操作符)。 More...
class  console::gen::reduce_t< T, BinaryOp >
 归约适配器,将生成器所有元素归约为单个值。 More...
class  console::gen::scan_t< T, BinaryOp >
class  console::gen::algorithm_t< F, Args >
 创建一个算法适配器。 More...
struct  console::ops::Pow< T >
 幂运算变换器。 More...
struct  console::ops::exp_t
 自然指数变换器。 More...
struct  console::ops::log10_t
 常用对数变换器(以10为底)。 More...
struct  console::ops::sin_t
 正弦变换器。 More...
struct  console::ops::cos_t
 余弦变换器。 More...
struct  console::ops::tan_t
 正切变换器。 More...
struct  console::ops::asin_t
 反正弦变换器。 More...
struct  console::ops::acos_t
 反余弦变换器。 More...
struct  console::ops::atan_t
 反正切变换器。 More...
struct  console::ops::sign_t
 符号变换器。 More...
struct  console::ops::round_t
 四舍五入变换器。 More...
struct  console::ops::ceil_t
 向上取整变换器。 More...
struct  console::ops::floor_t
 向下取整变换器。 More...
struct  console::ops::strlen_t
 字符串长度变换器。 More...
struct  console::ops::to_upper_t
 字符串转大写变换器。 More...
struct  console::ops::to_lower_t
 字符串转小写变换器。 More...
struct  console::ops::trim_t
 字符串去空格变换器。 More...
struct  console::ops::reverse_string_t
 字符串反转变换器。 More...
struct  console::ops::size_t_
 容器大小变换器。 More...
struct  console::ops::empty_t
 容器判空谓词。 More...
struct  console::ops::max_element_t
 容器最大值变换器。 More...
struct  console::ops::min_element_t
 容器最小值变换器。 More...
struct  console::ops::sum_t
 范围求和变换器。 More...
struct  console::ops::average_t
 范围平均值变换器。 More...
struct  console::ops::Between< T >
 区间谓词(闭区间)。 More...
struct  console::ops::BetweenExclusive< T >
 区间谓词(开区间)。 More...
struct  console::ops::DivisibleBy< T >
 整除谓词。 More...
struct  console::ops::power_of_two_t
 2的幂次谓词。 More...
struct  console::ops::palindrome_t
 回文数谓词。 More...
struct  console::ops::always_true_t
 恒真谓词。 More...
struct  console::ops::always_false_t
 恒假谓词。 More...
struct  console::ops::Clamp< T >
 限幅变换器。 More...
struct  console::ops::timestamp_t
 时间戳生成器。 More...
struct  console::ops::plus_t
 加法函数子。 More...
struct  console::ops::minus_t
 减法函数子。 More...
struct  console::ops::multiplies_t
 乘法函数子。 More...
struct  console::ops::divides_t
 除法函数子。 More...
struct  console::ops::modulus_t
 取模函数子。 More...
struct  console::ops::is_null_t
struct  console::ops::not_null_t
struct  console::ops::nth_t< N >
struct  console::ops::Method< Class, Ret, Args >
 成员函数调用变换器。 More...
struct  console::ops::Call< Args >
 函数调用变化器。 More...

Namespaces

namespace  console
 本库所有组件所在的顶层命名空间。
namespace  console::gen
namespace  console::ops

Functions

template<class Gen, class... Ops>
auto console::gen::operator| (Gen gen, pipeline_t< Ops... > pl) -> decltype(pl.pipeline(gen))
 管道操作符,将管道应用到生成器。
template<class... Ops>
pipeline_t< Ops... > console::gen::pipeline (Ops... ops)
 创建管道适配器。
template<class Op1, class Op2>
pipeline_t< Op1, Op2 > console::gen::operator% (Op1 op1, Op2 op2)
 管道组合操作符,用于连接两个适配器。
template<class T>
Random< T > console::gen::random (T min, T max, std::mt19937::result_type seed=std::random_device{}())
 创建随机数生成器。
FileLines console::gen::file_lines (const std::string &filename)
 创建文件行生成器。
FileChunks console::gen::file_chunks (const std::string &filename, size_t chunk_size=1024, std::ios_base::openmode mode=std::ios::in)
 创建文件块生成器。
window_t console::gen::window (size_t size=16)
 创建窗口适配器。
chunk_t console::gen::chunk (size_t size=16)
 创建分块适配器。
template<class Gen1, class Gen2>
Chain< Gen1, Gen2 > console::gen::chain (Gen1 g1, Gen2 g2)
 创建链式生成器,将两个生成器首尾连接。
template<class Gen, class... Rest>
auto console::gen::chain (Gen g, Rest... rest) -> Chain< Gen, decltype(chain(rest...))>
 创建链式生成器,将多个生成器首尾连接。
template<class Gen1, class Gen2>
Chain< Gen1, Gen2 > console::gen::operator+ (Gen1 g1, Gen2 g2)
 加号操作符重载,用于连接两个生成器。
step_by_t console::gen::step_by (size_t size=1)
 创建步进适配器。
debug_t console::gen::debug (std::string msg="DEBUG: ", std::ostream &os=std::cout)
 创建调试适配器。
template<class Pred>
take_until_t< Pred > console::gen::take_until (Pred p)
 创建取元素直到谓词成立适配器。
template<class Pred>
drop_until_t< Pred > console::gen::drop_until (Pred p)
 创建跳过元素直到谓词成立适配器。
template<class T, class BinaryOp>
reduce_t< T, BinaryOp > console::gen::reduce (const T &init, BinaryOp bo)
 创建归约适配器。
template<class T, class BinaryOp>
scan_t< T, BinaryOp > console::gen::scan (T init, BinaryOp op)
 创建一个扫描适配器。
template<class T, class... Args>
algorithm_t< T, Args... > console::gen::algorithm (T func, const Args &...args)
 创建算法适配器。
template<class T>
Pow< T > console::ops::pow (T exp)
 创建幂运算变换器。
template<class T>
Between< T > console::ops::between (T low, T high)
 创建闭区间谓词。
template<class T>
BetweenExclusive< T > console::ops::between_exclusive (T low, T high)
 创建开区间谓词。
template<class T>
DivisibleBy< T > console::ops::divisible_by (T n)
 创建整除谓词。
template<class T>
Clamp< T > console::ops::clamp (T low, T high)
 创建限幅变换器。
template<size_t N>
nth_t< N > console::ops::nth ()
 获取 tuple/pair/array 的第 N 个元素的函数。
template<class Class, class Ret, class... Args>
Method< Class, Ret, Args... > console::ops::method (Ret(Class::*ptr)(Args...), const Args &...args)
 创建成员函数调用器。
template<class... Args>
Call< Args... > console::ops::call (const Args &...args)
 创建函数调用器。

Variables

static constexpr exp_t console::ops::exp
static constexpr log10_t console::ops::log10
static constexpr sin_t console::ops::sin
static constexpr cos_t console::ops::cos
static constexpr tan_t console::ops::tan
static constexpr asin_t console::ops::asin
static constexpr acos_t console::ops::acos
static constexpr atan_t console::ops::atan
static constexpr sign_t console::ops::sign
static constexpr round_t console::ops::round
static constexpr ceil_t console::ops::ceil
static constexpr floor_t console::ops::floor
static constexpr strlen_t console::ops::strlen
static constexpr to_upper_t console::ops::to_upper
static constexpr to_lower_t console::ops::to_lower
static constexpr trim_t console::ops::trim
static constexpr reverse_string_t console::ops::reverse_string
static constexpr size_t_ console::ops::size
static constexpr empty_t console::ops::empty
static constexpr max_element_t console::ops::max_element
static constexpr min_element_t console::ops::min_element
static constexpr sum_t console::ops::sum
static constexpr average_t console::ops::average
static constexpr power_of_two_t console::ops::power_of_two
static constexpr palindrome_t console::ops::palindrome
static constexpr always_true_t console::ops::always_true
static constexpr always_false_t console::ops::always_false
static constexpr timestamp_t console::ops::timestamp
static constexpr plus_t console::ops::plus
static constexpr minus_t console::ops::minus
static constexpr multiplies_t console::ops::multiplies
static constexpr divides_t console::ops::divides
static constexpr modulus_t console::ops::modulus
static constexpr is_null_t console::ops::is_null
static constexpr not_null_t console::ops::not_null

Detailed Description

生成器库扩展功能。

为 gen.h 补充额外的生成器、适配器和工具函数。

Author
MrXie1109
Date
2026