-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
<array>: <array> includes too much stuff #462
Comments
It might be nice to actually go further and make |
I'd like to see |
That sounds fair to me |
Resolves microsoftGH-462. * Demote `back_inserter` and `iterator` to `<iterator>`. * Demote `_Yarn` to `<xlocinfo>`. * Demote `_Tidy_guard`, `_Tidy_deallocate_guard`, and `_Nothrow_compare` to `<xmemory>`. * Promote `_Swap_ranges_unchecked` to `<xutility>`. * Change `<array>` to include only `<xutility>`.
* Reduce the amount of content included by <array>. Resolves GH-462. * Demote `back_inserter` and `iterator` to `<iterator>`. * Demote `_Yarn` to `<xlocinfo>`. * Demote `_Tidy_guard`, `_Tidy_deallocate_guard`, and `_Nothrow_compare` to `<xmemory>`. * Promote `_Swap_ranges_unchecked` to `<xutility>`. * Change `<array>` to include only `<xutility>`. * Un-demote iterator. * Workaround many RWC projects that expected std::min and std::max to come from <array>. * Remove the `_STL_ASSERT` from `std::min` and `std::max`. We normally guard every `op<` with debug checks, but in this case we aren't using it to enforce something like a container invariant; the number of bad op<s we catch with it are likely microscopic. * Delete `_Min_value` and `_Max_value` from `<utility>`. * Move `min` and `max` to `<utility>` (in the exact position as the old `_Min_value` and `_Max_value`) * Change all existing callers of `_Min_value` and `_Max_value` to call `(_STD min)` and `(_STD max)`, respectively. * Homogenize vector algorithm guards.
In @ned14 's recent STL header benchmark results,
<array>
stands out as the most expensive STL container header. See https://www.reddit.com/r/cpp/comments/eumou7/stl_header_token_parsing_benchmarks_for_vs2017/ . This is because<array>
includes<iterator>
(becausereverse_iterator
used to be in there?),<tuple>
(because when we authored<array>
the tuple interface wasn't in<type_traits>
yet?), and<algorithm>
(for_Swap_ranges_unchecked
). These are needless overhead for the functionality<array>
offers.It probably would make sense to promote
_Swap_ranges_unchecked
to<xutility>
or similar with all the other "optimized for trivial things" algorithms likecopy
,The text was updated successfully, but these errors were encountered: