Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@JMazurkiewicz
Copy link
Contributor

@JMazurkiewicz JMazurkiewicz commented Jun 29, 2023

In #3561 I've introduced _Compile_time_max_size template variable that detects ranges with max size known at compile time. Those types currently are:

  • const? std::array<T, N> (_Compile_time_max_size = N),
  • const? std::span<T, N> (_Compile_time_max_size = N),
  • const? ref_view<T> (_Compile_time_max_size = _Compile_time_max_size<T>),
  • const? owning_view<T> (_Compile_time_max_size = _Compile_time_max_size<T>).
  • Types with static constexpr size function, like empty_view (_Compile_time_max_size = 0), single_view (_Compile_time_max_size = 1).

(More about this approach: #3561, 'implementation details' section).

This PR expands influence of _Compile_time_max_size to all possible range adaptors and to C-style arrays.

@JMazurkiewicz JMazurkiewicz requested a review from a team as a code owner June 29, 2023 11:31
@StephanTLavavej StephanTLavavej added enhancement Something can be improved ranges C++20/23 ranges labels Jun 30, 2023
@strega-nil-ms strega-nil-ms self-assigned this Jun 30, 2023
@StephanTLavavej

This comment was marked as resolved.

#if _HAS_CXX23
template <class _Rng, class _Fn, size_t _Nx>
inline constexpr auto _Compile_time_max_size<adjacent_transform_view<_Rng, _Fn, _Nx>> =
_Compile_time_max_size<adjacent_view<_Rng, _Nx>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no change requested - this could be _Adjacent_view_compile_time_max_size<_Rng, _Nx>() to avoid the indirection.

@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit b32f3b4 into microsoft:main Jul 14, 2023
@StephanTLavavej
Copy link
Member

Thanks for enhancing this metaprogramming! πŸ“ˆ πŸš€ ✨

@JMazurkiewicz JMazurkiewicz deleted the compile-time-max-size branch July 14, 2023 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved ranges C++20/23 ranges

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants