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

STL.natvis: ranges::view_interface doesn't always have size() #4830

Closed
StephanTLavavej opened this issue Jul 11, 2024 · 0 comments · Fixed by #4835
Closed

STL.natvis: ranges::view_interface doesn't always have size() #4830

StephanTLavavej opened this issue Jul 11, 2024 · 0 comments · Fixed by #4835
Labels
bug Something isn't working fixed Something works now, yay! visualizer How the VS debugger displays STL types

Comments

@StephanTLavavej
Copy link
Member

STL/stl/inc/xutility

Lines 3766 to 3779 in ef1d621

_NODISCARD constexpr auto size()
requires forward_range<_Derived> && sized_sentinel_for<sentinel_t<_Derived>, iterator_t<_Derived>>
{
auto& _Self = _Cast();
return _STD _To_unsigned_like(_RANGES end(_Self) - _RANGES begin(_Self));
}
_NODISCARD constexpr auto size() const
requires forward_range<const _Derived>
&& sized_sentinel_for<sentinel_t<const _Derived>, iterator_t<const _Derived>>
{
auto& _Self = _Cast();
return _STD _To_unsigned_like(_RANGES end(_Self) - _RANGES begin(_Self));
}

STL/stl/debugger/STL.natvis

Lines 2004 to 2012 in ef1d621

<Type Name="std::ranges::view_interface&lt;*&gt;">
<DisplayString>{{ size={size()} }}</DisplayString>
<Expand>
<Item Optional="true" Name="empty">empty()</Item>
<Item Optional="true" Name="front">front()</Item>
<Item Optional="true" Name="back">back()</Item>
<Item Optional="true" Name="data">data()</Item>
</Expand>
</Type>

Reported by @xiangfan-ms:

The 'size' member function doesn't always exist in the specialization. When this happens, the entry will be ignored by the debugger.

Present since this visualizer was added by #2191 on 2022-07-11 in VS 2022 17.4.

@StephanTLavavej StephanTLavavej added bug Something isn't working visualizer How the VS debugger displays STL types labels Jul 11, 2024
@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Something works now, yay! visualizer How the VS debugger displays STL types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant