All Projects → ofats → any_invocable

ofats / any_invocable

Licence: MIT license
Сonservative, move-only equivalent of std::function

Programming Languages

C++
36643 projects - #6 most used programming language
Starlark
911 projects
CMake
9771 projects
shell
77523 projects

Projects that are alternatives of or similar to any invocable

gal
Geometric Algebra Library
Stars: ✭ 78 (+457.14%)
Mutual labels:  cplusplus-17, cpp20, cplusplus-20
Libcudacxx
The C++ Standard Library for your entire system.
Stars: ✭ 1,861 (+13192.86%)
Mutual labels:  std, cpp20
cxbqn
BQN virtual machine
Stars: ✭ 20 (+42.86%)
Mutual labels:  cpp20
cpp-tutor
Code examples for tutoring modern C++
Stars: ✭ 52 (+271.43%)
Mutual labels:  cplusplus-17
banana
🍌 Modern C++ Telegram Bot API library
Stars: ✭ 30 (+114.29%)
Mutual labels:  cpp20
HitagiEngine
DirectX12 game engine
Stars: ✭ 51 (+264.29%)
Mutual labels:  cpp20
programming-with-cpp20
Companion source code for "Programming with C++20 - Concepts, Coroutines, Ranges, and more"
Stars: ✭ 142 (+914.29%)
Mutual labels:  cpp20
so stupid search
It's my honor to drive you fucking fire faster, to have more time with your Family and Sunshine.This tool is for those who often want to search for a string Deeply into a directory in Recursive mode, but not with the great tools: grep, ack, ripgrep .........every thing should be Small, Thin, Fast, Lazy....without Think and Remember too much ...一…
Stars: ✭ 135 (+864.29%)
Mutual labels:  cpp20
tnt
A 2d Game Engine written in C++20.
Stars: ✭ 30 (+114.29%)
Mutual labels:  cpp20
LittleEngineVk
3D game engine using C++20 and Vulkan (WIP)
Stars: ✭ 87 (+521.43%)
Mutual labels:  cpp20
triviabot
A Discord Trivia/Quiz bot with over 150,000 questions and lots of features!
Stars: ✭ 23 (+64.29%)
Mutual labels:  cplusplus-17
oof
Convenient, high-performance RGB color and position control for console output
Stars: ✭ 764 (+5357.14%)
Mutual labels:  cpp20
qcoro
C++ Coroutines for Qt
Stars: ✭ 150 (+971.43%)
Mutual labels:  cpp20
RikerBot
C++20/Python based Minecraft bot
Stars: ✭ 44 (+214.29%)
Mutual labels:  cpp20
thread-pool
BS::thread_pool: a fast, lightweight, and easy-to-use C++17 thread pool library
Stars: ✭ 1,043 (+7350%)
Mutual labels:  cplusplus-17
apecs
A petite entity component system
Stars: ✭ 17 (+21.43%)
Mutual labels:  cpp20
engine
A personal game engine project, with development focus towards 2D/2.5D games.
Stars: ✭ 32 (+128.57%)
Mutual labels:  cpp20
qt raytracer challenge
Implementation based on the book The Ray Tracer Challenge
Stars: ✭ 18 (+28.57%)
Mutual labels:  cplusplus-17
cxx
🔌 Configuration-free utility for building, testing and packaging executables written in C++. Can auto-detect compilation flags based on includes, via the package system and pkg-config.
Stars: ✭ 87 (+521.43%)
Mutual labels:  cpp20
ahsohtoa
Structure-of-array synthesis in C++20
Stars: ✭ 59 (+321.43%)
Mutual labels:  cplusplus-20

any_invocable

One of possible implementations of std::any_invocable proposed in P0288R5.

This paper proposes a conservative, move-only equivalent of std::function.

Current build

Linux build status macOS build status Windows build status

Motivating Example

Such a code:

// requires: C++14
#include <functional>
#include <memory>

struct widget {
    // ...
};

int main() {
    std::function<void()> f = [w_ptr = std::make_unique<widget>()] { /*...*/ };
}

Will result in:

error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = widget; _Dp = std::default_delete<widget>]

In other words, we can't store move-only callables in std::function.

At the same time such a code will work:

std::any_invocable<void()> f = [w_ptr = std::make_unique<widget>()] { /*...*/ };
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].