Template Function tvm::ffi::StructuralMap

Template Function tvm::ffi::StructuralMap#

Function Documentation#

template<WalkOrder order, typename ...Callbacks>
Any tvm::ffi::StructuralMap(Any root, Callbacks&&... callbacks)#

Throwing form of tvm::ffi::StructuralMapExpected.

See tvm::ffi::StructuralMapExpected for callback dispatch, ordering, and ownership semantics.

Note

Returning Expected<Any> expresses errors as values; throwing Error is also supported and is rethrown by this interface.

Note

Pass an owned root with std::move(root) to permit root reuse.

Template Parameters:
  • order – Whether callbacks run before or after recursively mapping children.

  • Callbacks – Callback types whose first parameters select matching values.

Parameters:
  • root – The owning root value to map.

  • callbacks – Callbacks tested in declaration order. Each accepts (value) or (value, def_region_kind) and returns a replacement, Unchanged, or Expected<Any>.

Throws:

Error – if mapping or a callback fails.

Returns:

The mapped owning value.