Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api(span.h): Only allow span-from-array if array for compatible size #4656

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Mar 8, 2025

From an array of known size, we can implicitly construct a span of dynamic length, or of fixed length equal to the array length. Use template enable_if trick to restrict to these cases.

Previously, the constructor would have allowed a fixed-length span to be constructed from an array of differing length, which should obviously have been disallowed.

From an array of known size, we can implicitly construct a span of
dynamic length, or of fixed length equal to the array length.  Use
template enable_if trick to restrict to these cases.

Previously, the constructor would have allowed a fixed-length span to
be constructted from an array of differing length, which should
obviously have been disallowed.

Signed-off-by: Larry Gritz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant