diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-09-23 16:49:28 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-09-23 16:49:28 -0400 |
commit | 626920dda38a512b27c5e8fd79b0c9b09be01898 (patch) | |
tree | 89c54e31848048ee084005fd3a0a1316f5530966 /indra/llcommon/always_return.h | |
parent | f6b3b5e803b0c08d55ecd10eac3e9e75518760a9 (diff) | |
parent | d8e52ec001c476a2320f2d5caceb813465d707e4 (diff) |
Merge remote branch 'develop' into release/luau-scripting for Maint B
Diffstat (limited to 'indra/llcommon/always_return.h')
-rw-r--r-- | indra/llcommon/always_return.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/indra/llcommon/always_return.h b/indra/llcommon/always_return.h index a206471da5..b99eb49096 100644 --- a/indra/llcommon/always_return.h +++ b/indra/llcommon/always_return.h @@ -79,6 +79,22 @@ namespace LL DESIRED mDefault; }; + // specialize for AlwaysReturn<void> + template <> + struct AlwaysReturn<void> + { + public: + AlwaysReturn() {} + + // callable returns a type not convertible to DESIRED, return default + template <typename CALLABLE, typename... ARGS> + void operator()(CALLABLE&& callable, ARGS&&... args) + { + // discard whatever callable(args) returns + std::forward<CALLABLE>(callable)(std::forward<ARGS>(args)...); + } + }; + /** * always_return<T>(some_function, some_args...) calls * some_function(some_args...). It is guaranteed to return a value of type |