add additional bit to resolve docs.

This commit is contained in:
ThePhD 2016-11-13 03:28:32 -05:00
parent 72af3c6264
commit 85a72a9ae0

View File

@ -9,7 +9,7 @@ utility to pick overloaded C++ function calls
template <typename... Args, typename F>
auto resolve( F f );
``resolve`` is a function that is meant to help users pick a single function out of a group of overloaded functions in C++. You can use it to pick overloads by specifying the signature as the first template argument. Given a collection of overloaded functions:
``resolve`` is a function that is meant to help users pick a single function out of a group of overloaded functions in C++. It works for *both member and free functions* You can use it to pick overloads by specifying the signature as the first template argument. Given a collection of overloaded functions:
.. code-block:: cpp
:linenos:
@ -18,6 +18,12 @@ utility to pick overloaded C++ function calls
int overloaded(int x, int y);
int overloaded(int x, int y, int z);
struct thing {
int overloaded(int x);
int overloaded(int x, int y);
int overloaded(int x, int y, int z);
};
You can disambiguate them using ``resolve``:
.. code-block:: cpp
@ -26,6 +32,7 @@ You can disambiguate them using ``resolve``:
auto one_argument_func = resolve<int(int)>( overloaded );
auto two_argument_func = resolve<int(int, int)>( overloaded );
auto three_argument_func = resolve<int(int, int, int)>( overloaded );
auto member_three_argument_func = resolve<int(int, int, int)>( &thing::overloaded );
This resolution becomes useful when setting functions on a :doc:`table<table>` or :doc:`state_view<state>`: