Skip to content

Use std::data and std::size for boost equivalents, when possible#207

Closed
Lastique wants to merge 2 commits intodevelopfrom
feature/use_std_data_size
Closed

Use std::data and std::size for boost equivalents, when possible#207
Lastique wants to merge 2 commits intodevelopfrom
feature/use_std_data_size

Conversation

@Lastique
Copy link
Member

This avoids the potential ambiguity between boost:: and std:: functions when the user calls data() or size() unqualified and both alternatives are found via ADL.

Fixes #206.

This avoids the potential ambiguity between boost:: and std:: functions
when the user calls data() or size() unqualified and both alternatives
are found via ADL.

Refs #206.
@pdimov
Copy link
Member

pdimov commented Oct 16, 2025

I like having a test that checks exactly what's being reported as a problem; in this case, invoking data(sp) unqualified on a boost::span when using std::data; is in effect.

@Lastique
Copy link
Member Author

The added tests are for the changes in data and size. span is unchanged, so I didn't add the test for it. I can add a test for it as well, but it'll duplicate the tests added for data and size.

@Lastique
Copy link
Member Author

I can add a test for it as well, but it'll duplicate the tests added for data and size.

Done.

The test checks that unqualified calls to data()/size() with boost::span
as argument don't cause ambiguity between std:: and boost:: implementations.

Fixes #206.
@Lastique Lastique force-pushed the feature/use_std_data_size branch from 8f0f48c to 609c742 Compare October 16, 2025 20:30
@Lastique
Copy link
Member Author

Any objections to merging this?

@Lastique Lastique closed this Oct 19, 2025
@Lastique Lastique deleted the feature/use_std_data_size branch October 19, 2025 18:56
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.

Overload resolution ambiguity between std::data and boost::data on boost::span

2 participants