diff options
Diffstat (limited to 'third_party/function2')
-rw-r--r-- | third_party/function2/Readme.md | 14 | ||||
-rw-r--r-- | third_party/function2/include/function2/function2.hpp | 8 | ||||
-rw-r--r-- | third_party/function2/moz.yaml | 4 |
3 files changed, 17 insertions, 9 deletions
diff --git a/third_party/function2/Readme.md b/third_party/function2/Readme.md index d8d2bdc45e..7556e83e8e 100644 --- a/third_party/function2/Readme.md +++ b/third_party/function2/Readme.md @@ -63,7 +63,7 @@ Use `fu2::function` as a wrapper for copyable function wrappers and `fu2::unique The standard implementation `std::function` and `fu2::function` are convertible to each other, see [the chapter convertibility of functions](#convertibility-of-functions) for details. A function wrapper is declared as following: -```cpp +```c++ fu2::function<void(int, float) const> // Return type ~^ ^ ^ ^ // Parameters ~~~~~|~~~~~| ^ @@ -98,7 +98,7 @@ fu2::function<void(int, float) const> `fu2::function` and `fu2::unique_function` (non copyable) are easy to use: -```cpp +```c++ fu2::function<void() const> fun = [] { // ... }; @@ -111,7 +111,7 @@ fun(); `fu2::unique_function` also works with non copyable functors/ lambdas. -```cpp +```c++ fu2::unique_function<bool() const> fun = [ptr = std::make_unique<bool>(true)] { return *ptr; }; @@ -127,7 +127,7 @@ otherfun(); A `fu2::function_view` can be used to create a non owning view on a persistent object. Note that the view is only valid as long as the object lives. -```cpp +```c++ auto callable = [ptr = std::make_unique<bool>(true)] { return *ptr; }; @@ -164,7 +164,7 @@ fu2::function_view<bool() const> view(callable); | fu2::unique_function | No | Yes | No | | std::function | Yes | Yes | Yes | -```cpp +```c++ fu2::function<void()> fun = []{}; // OK std::function<void()> std_fun = fun; @@ -197,14 +197,14 @@ struct my_capacity { The following code defines an owning function with a variadic signature which is copyable and sfo optimization is disabled: -```cpp +```c++ template<typename Signature> using my_function = fu2::function_base<true, true, fu2::capacity_none, true, false, Signature>; ``` The following code defines a non copyable function which just takes 1 argument, and has a huge capacity for internal sfo optimization. Also it must be called as r-value. -```cpp +```c++ template<typename Arg> using my_consumer = fu2::function_base<true, false, fu2::capacity_fixed<100U>, true, false, void(Arg)&&>; diff --git a/third_party/function2/include/function2/function2.hpp b/third_party/function2/include/function2/function2.hpp index e6dfca072e..ffb82b5ef7 100644 --- a/third_party/function2/include/function2/function2.hpp +++ b/third_party/function2/include/function2/function2.hpp @@ -1828,6 +1828,14 @@ constexpr auto overload(T&&... callables) { } } // namespace fu2 +namespace std{ +template <typename Config, typename Property, typename Alloc> +struct uses_allocator< + ::fu2::detail::function<Config, Property>, + Alloc +> : std::true_type {}; +} // namespace std + #undef FU2_DETAIL_EXPAND_QUALIFIERS #undef FU2_DETAIL_EXPAND_QUALIFIERS_NOEXCEPT #undef FU2_DETAIL_EXPAND_CV diff --git a/third_party/function2/moz.yaml b/third_party/function2/moz.yaml index f1f1376b9f..d4fd5a2043 100644 --- a/third_party/function2/moz.yaml +++ b/third_party/function2/moz.yaml @@ -10,9 +10,9 @@ origin: url: https://naios.github.io/function2/ - release: a354bd093d2b6e50c9325dbce84d20b4e77aabc6 (2023-11-04T12:44:54Z). + release: 43fc0ca473ecb081918709bd7d524d84c2ff8dce (2024-02-25T17:37:03Z). - revision: a354bd093d2b6e50c9325dbce84d20b4e77aabc6 + revision: 43fc0ca473ecb081918709bd7d524d84c2ff8dce license: BSL-1.0 license-file: LICENSE.txt |