Skip to content

Add static asserts to gsl::narrow for template parameter pairs that can never work #786

Description

@B3ret

I just ran into this with some templated code.
Basically some pairs of template parameters in gsl::narrow will almost always fail at runtime, e.g., gsl::narrow<float, double> and gsl::narrow<double, int>.

I know it is a clear progammer's mistake to do this, but maybe we can static assert, or at least warn about pairs that are very unlikely to be correct?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions