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

std::array #55

Open
parchinskiy opened this issue Jul 20, 2024 · 3 comments
Open

std::array #55

parchinskiy opened this issue Jul 20, 2024 · 3 comments

Comments

@parchinskiy
Copy link

Hi, since C++03 is no longer supported, is there any reason not to add an overload for std::array here?

@pdimov
Copy link
Member

pdimov commented Jul 20, 2024

I suppose it makes sense. <array> is a surprisingly heavy header to include, though, because it often includes <algorithm>, so this is one possible drawback.

@parchinskiy
Copy link
Author

parchinskiy commented Jul 21, 2024

@pdimov Maybe instead of overloading for an array, it makes sense for functions like big_to_native_in_place, native_to_big_in_place, etc. to add overloads with iterators? Then you will not need to include <array> and the number of supported types will increase.

@pdimov
Copy link
Member

pdimov commented Jul 21, 2024

Yes, I was wondering whether supporting just std::array was justified, as I assume std::vector support would also be legitimate. And there are also std::pair and std::tuple, for which reverse in place also makes sense.

It's in principle possible to do what ContainerHash does and support all containers and tuple-likes by default, although that's somewhat outside the current scope of the Endian library. (We can even make described structs work out of the box.)

Out of curiosity, what is you current use case for supporting std::array? Do you need support for other containers, or for pair/tuple?

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

No branches or pull requests

2 participants