Commit Graph

4 Commits (aed6313d7c755ae1b980074fc27dfd98267fca24)

Author SHA1 Message Date
Andrey Kleshchev 34b83e4047 Post merge build fix 2023-10-25 23:37:23 +03:00
Nat Goodspeed 8855a82f51 DRTVWR-558: Add LL::apply() test for function(const LLSD&).
(cherry picked from commit 7d33e00d925614911a7602da1bd79916cc849ad7)
2023-07-13 12:34:31 -04:00
Nat Goodspeed 196e49c1f8 DRTVWR-558: Add unit test for VAPPLY().
Add to apply_test.cpp a collect() function that incrementally accumulates an
arbitrary number of arguments into a std::vector<std::string>. Construct a
std::array<std::string> to pass it, using VAPPLY().

Clarify in header comments that LL::apply() can't call a variadic function
with arguments of dynamic size: std::vector or LLSD. The compiler can deduce
how many arguments to pass to a function with a fixed argument list; it can
deduce how many arguments to pass to a variadic function with a fixed number
of arguments. But it can't compile a call to a variadic function with an
arguments data structure whose size can vary at runtime.

(cherry picked from commit ceed33396266b123896f7cfb9b90abdf240e1eec)
2023-07-13 12:34:31 -04:00
Nat Goodspeed c682603417 DRTVWR-558: Extend LL::apply() to LLSD array arguments.
Make apply(function, std::array) and apply(function, std::vector) available
even when we borrow the C++17 implementation of apply(function, std::tuple).

Add apply(function, LLSD) with interpretations:

* isUndefined() is treated as an empty array, for calling a nullary function
* scalar LLSD is treated as a single-entry array, for calling a unary function
* isArray() converts function parameters using LLSDParam
* isMap() is an error.

Add unit tests for all flavors of LL::apply().

(cherry picked from commit 3006c24251c6259d00df9e0f4f66b8a617e6026d)
2023-07-13 12:34:12 -04:00