Skip to content

[c++] Consider taking std::string_view or similar for strings #3834

@Wumpf

Description

@Wumpf

Right now the C++ api uses nullterminated const char* everywhere which is nice for C (and ultimiately Rust) interop.
However, passing in std::string can get a bit clumsy:

rec.log(
        (std::string("world/") + name + "_pt").c_str(),
        rerun::Points3D({pos}).with_colors(color)
    );

The modern way is to use std::string_view but the problem is that they are not guaranteed to be nullterminated, complicating the FFI - either C needs to get more complex string types as well or we do a temp allocation for this!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestsdk-cppC/C++ API specific

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions