This reduces verbosity when using `LinearAllocator` or `ResourceScope` to allocate values for a `CPPType`. Now, this is simplified and one also does not have to manually add a destructor call anymore. Pull Request: https://projects.blender.org/blender/blender/pulls/137685
22 lines
731 B
C++
22 lines
731 B
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#include "FN_multi_function_params.hh"
|
|
|
|
namespace blender::fn::multi_function {
|
|
|
|
void ParamsBuilder::add_unused_output_for_unsupporting_function(const CPPType &type)
|
|
{
|
|
ResourceScope &scope = this->resource_scope();
|
|
void *buffer = scope.allocator().allocate_array(type, min_array_size_);
|
|
const GMutableSpan span{type, buffer, min_array_size_};
|
|
actual_params_.append_unchecked_as(std::in_place_type<GMutableSpan>, span);
|
|
if (!type.is_trivially_destructible) {
|
|
scope.add_destruct_call(
|
|
[&type, buffer, mask = mask_]() { type.destruct_indices(buffer, mask); });
|
|
}
|
|
}
|
|
|
|
} // namespace blender::fn::multi_function
|