Skip to content

Commit 1c4417d

Browse files
author
Simon Brand
committed
Docs
1 parent f9b7c54 commit 1c4417d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/index.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,17 @@ public:
3636
R <a href='doc_function_ref.html#tl::function_ref-R(Args...)-::operator()(Args...)const'>operator()</a>(Args... args) const;
3737
};</code></pre>
3838

39-
Specialization for function types.
39+
A lightweight non-owning reference to a callable.
40+
41+
Example usage:
42+
43+
``` cpp
44+
void foo (function_ref<int(int)> func) {
45+
std::cout << "Result is " << func(21); //42
46+
}
47+
48+
foo([](int i) { return i*2; });
49+
```
4050
4151
### Copy constructor `tl::function_ref<R(Args...)>::function_ref`<a id="tl::function_ref-R(Args...)-::function_ref(constfunction_ref-R(Args...)-&)"></a>
4252

0 commit comments

Comments
 (0)