Args
Header only library for binding, reordering and currying of function arguments without cost
Install / Use
/learn @JustasMasiulis/ArgsREADME
args
A header only functional programming support library without type erasure.
void foo(int, float, const char*);
// all of the examples below call foo(1, 2.f, "3") and are optimized out in release builds
auto reordered = args::reorder<2, 0, 1>(foo);
reordered("3", 1, 2.f);
auto bound = args::bind<1>(foo, 2.f);
bound(1, "hello");
auto curried = args::curry<0, 2>(foo);
auto bound2 = curried(1, "3");
bound2(2.f);
quick documentation
- Both functions and arguments are stored by value. Use std::ref to avoid copies.
- Chaining of the library functions is possible.
- Type erasure is not performed.
template<std::size_t... ArgIndices, class Fn>
constexpr /* callable object */ reorder(Fn&& function);
reorder<2, 0, 1>(void(int, float, const char*)) -> void(const char*, int, float)
template<std::size_t... ArgIndices, class Fn, class... Args>
constexpr /* callable object */ bind(Fn&& function, Args&&... values_to_bind);
bind<1>(void(int, float, const char*), float) -> void(int, const char*)
template<std::size_t... ArgIndices, class Fn>
constexpr /* callable object */ curry(Fn&& function);
curry<2>(void(int, float, const char*)) -> (void(int, float))(const char*)
Related Skills
node-connect
352.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
