Skip to content

GetShapes() nodisard when passing the count as capacity #21

@jhasse

Description

@jhasse

First of all thanks again for the library! I've ported our game jam project to it and it worked perfectly, it's much better than the old Box2D v2 C++ API.

One thing I've noticed is that when using the following pattern:

const auto count = body.GetShapeCount();
auto shapes = std::make_unique<b2ShapeId[]>(count);
body.GetShapes(shapes.get(), count);

I get Ignoring return value of function declared with 'nodiscard' attribute since GetShapes is [[nodiscard]]. But I guess that it might be quite common to just reserve the whole array up front like I did? Or maybe there should be a GetAllShapes method?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions