Skip to content

Consider providing constant instead of named_unit for constants #677

@mpusz

Description

@mpusz

Such constants could have superpowers. They could implicitly convert to a quantity and provide additional compile-time overflow protection as discussed in #669_

One possible problem is to decide which representation type should be used in case we want to allow CTAD (e.g., quantity{si::standard_gravity}). Forcing std::arithmetic types might be a no-go for some projects that use safe numeric wrappers. This is actually where the current unit-based approach shines. The constant is orthogonal to the representation type in a quantity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    designDesign-related discussion

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions