All Projects → TartanLlama → Function_ref

TartanLlama / Function_ref

Licence: other
A lightweight, non-owning reference to a callable.

function_ref

A lightweight non-owning reference to a callable.

Clang + GCC: Linux Build Status MSVC: Windows Build Status

Use tl::function_ref instead of std::function whenever you don't need to own the callable. The most common case for this is function parameters which aren't stored anywhere:

void foo (function_ref<int(int)> func) {
    std::cout << "Result is " << func(21); //42
}

foo([](int i) { return i*2; });

Full documentation available here.


CC0

To the extent possible under law, Simon Brand has waived all copyright and related or neighboring rights to the function_ref library. This work is published from: United Kingdom.

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].