[libcxx-commits] [libcxx] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Dec 30 04:28:14 PST 2023
================
@@ -163,20 +163,23 @@ class _LIBCPP_TEMPLATE_VIS basic_format_context<typename __format::__retarget_bu
# endif
__ctx_(std::addressof(__ctx)),
__arg_([](void* __c, size_t __id) {
- return std::visit_format_arg(
- [&](auto __arg) -> basic_format_arg<basic_format_context> {
- if constexpr (same_as<decltype(__arg), monostate>)
- return {};
- else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Context>::handle>)
- // At the moment it's not possible for formatting to use a re-targeted handle.
- // TODO FMT add this when support is needed.
- std::__throw_format_error("Re-targeting handle not supported");
- else
- return basic_format_arg<basic_format_context>{
- __format::__determine_arg_t<basic_format_context, decltype(__arg)>(),
- __basic_format_arg_value<basic_format_context>(__arg)};
- },
- static_cast<_Context*>(__c)->arg(__id));
+ auto visitor = [&](auto __arg) -> basic_format_arg<basic_format_context> {
----------------
mordante wrote:
```suggestion
auto __visitor = [&](auto __arg) -> basic_format_arg<basic_format_context> {
```
https://github.com/llvm/llvm-project/pull/76449
More information about the libcxx-commits
mailing list