[libcxx-commits] [PATCH] D131082: [libcxx] Add _LIBCPP_NODEBUG to std::conditional related typedfs
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 1 09:50:20 PDT 2022
ldionne added a comment.
Thanks a lot both for the explanation and sorry this fell under the radar. On the surface, I think this looks like a pure improvement on all aspects, in that case.
Just before we go forward, is there any way to still see the full type of the variable (i.e. `std::conditional<false, std::basic_string_view<char, std::char_traits<char> >, int>::type`), or is that information lost forever? If it's lost forever, basically one would have to substitute the various types by hand into the `std::conditional` template?
// We know this from the fact that we're in my_forward<int>:
T = int
// So we manually substitute:
typename std::conditional<std::is_same<T, const char*>::value, std::string_view, T>::type
-> typename std::conditional<std::is_same<int, const char*>::value, std::string_view, int>::type
-> typename std::conditional<false, std::string_view, int>::type // this is roughly what we would get without _LIBCPP_NODEBUG_TYPE
Is there an easier way to figure out that type in the debugger, or not? I don't think it's a dealbreaker if not, but I'd like to understand.
================
Comment at: libcxx/include/__type_traits/conditional.h:39-45
+struct _LIBCPP_TEMPLATE_VIS conditional {
+ _LIBCPP_NODEBUG typedef _If type;
+};
template <class _If, class _Then>
- struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {typedef _Then type;};
+struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {
+ _LIBCPP_NODEBUG typedef _Then type;
+};
----------------
dblaikie wrote:
> ldionne wrote:
> >
> Should be do the typedef->using as a separate change? Happy to send another patch.
I really don't mind.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131082/new/
https://reviews.llvm.org/D131082
More information about the libcxx-commits
mailing list