Blender Git Commit Log

Git Commits -> Revision aa48825

Revision aa48825 by Jacques Lucke (master)
February 23, 2021, 10:52 (GMT)
BLI: new FunctionRef type

Using `FunctionRef` is better than using `std::function`, templates and c function
pointers in some cases. The trade offs are explained in more detail in code documentation.

The following are some of the main benefits of using `FunctionRef`:
* It is convenient to use with all kinds of callables.
* It is cheaper to construct, copy and (possibly) call compared to `std::function`.
* Functions taking a `FunctionRef` as parameter don't need to be declared
in header files (as is necessary when using templates usually).

Differential Revision: https://developer.blender.org/D10476

Commit Details:

Full Hash: aa4882506c9acb5483b506c5e1d1569ca8cf5dd3
Parent Commit: b2e1b13
Lines Changed: +258, -0

2 Added Paths:

/source/blender/blenlib/BLI_function_ref.hh (+154, -0) (View)
/source/blender/blenlib/tests/BLI_function_ref_test.cc (+102, -0) (View)

1 Modified Path:

/source/blender/blenlib/CMakeLists.txt (+2, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021