matlab::data::apply_visitor - Call Visitor class on arrays - MATLAB (original) (raw)

Main Content

Call Visitor class on arrays

Description

auto apply_visitor(Array a, V visitor) dispatch to visitor class operations based on array type.

Use apply_visitor to pass in an instance of Array or one of its subclasses and a visitor functor, and invoke the operator() method, which must be defined in the user-defined functor, with the appropriate concrete array type.

Include

Namespace: matlab::data
Include ArrayVisitors.hpp

Parameters

matlab::data::Array a&& The matlab::data::Array to operate on with the visitor class, passed: by valueby const lvalue refby rvalue refby nonconst lvalue refTo modify the original array, pass it byrvalue ref into theoperator() method and return the modified array. Then the calling code should move the returned array into the old array. Due to copy-on-write behavior, passing by nonconst lvalue ref does not modify the original array.
visitor class V&& The user-supplied visitor object, passed: by valueby const lvalue refby rvalue refby nonconst lvalue ref

Return Value

auto Outputs returned by the visitor.

Version History

Introduced in R2017b

See Also