Skip to content

C++ wpi::MakeStructArraySchema creates an incorrect schema #8149

@bhall-ctre

Description

@bhall-ctre

Instead of creating an array of the target schema type, wpi::MakeStructArraySchema (and by extension wpi::Struct<std::array<T, N>>::GetSchema()) instead copies the schema from the target type and makes the last field an array.

For example, consider the struct definition for a std::array<frc::Pose2d, 2>. The expected schema should look something like:

Pose2d values[2]

However, the generated schema is instead:

Translation2d translation;Rotation2d rotation[2]

which is not equivalent to our desired array.

Because an identifier is required in a struct schema, I believe wpi::MakeStructArraySchema should take a std::string_view ident, and the Struct template specialization should as a result be wpi::Struct<std::array<T, N>, std::string_view, I...>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions