Skip to content

[RNE Rewrite] Use std::span instead of raw pointers in native C++ ops #1308

Description

@msluszniak

In the FSMN-VAD framing op (cpp/extensions/speech/operations.cpp, #1298) we replaced raw float* pointers and manual pointer arithmetic over tensor buffers with std::span: wrapping reinterpret_cast<T*>(tensor->data_.get()) in a span, taking a subspan per row/window, and using range-based algorithms (std::ranges::fill, range-for). This is more expressive and less error-prone than raw pointer math.

The scope of this issue is to apply the same treatment to the other native ops that still index tensor buffers through raw pointers:

  • cpp/extensions/cv/image_ops.cpp
  • cpp/extensions/math/operations.cpp
  • cpp/extensions/cv/box_ops.cpp

Core files (cpp/core/{tensor,model}.cpp) also use raw buffer access, but per the core guidelines they should be touched with more care — out of scope here unless it is a clear, low-risk win.

Metadata

Metadata

Assignees

Type

Fields

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions