Skip to content

Clarify scalar operator() signature in MultiScalarTransform

For each 'row' processed, MultiScalarTransform expects an optional<tuple<Out::value_type...>> to indicate whether it should append the result to its output vectors, or skip this entry.

The original code could have been interpreted as accepting a tuple<Out::value_type...>*, which would result in leaked memory (at best). With this commit, this (erroneous) code will no longer compile.

In addition, allow tuple<Out::value_type...> as return type which implies an unconditional append to the outputs for each row in the input(s).

Finally, instead of hardwiring boost::optional<T> as the above mentioned optional, define an optional<T> as a value which can be cast to bool (note: where as std::optional::has_value() exist, boost::optional::has_value() requires boost 1.68 or later -- hence for compatibility with earlier versions of boost, the explicit conversion to bool is checked instead), and which has a value() member function. This allows the use of std::optional in C++17 code without having to mention it, i.e. whilst keeping the source code compatible with C++14...

Edited by Gerhard Raven

Merge request reports

Loading