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
<format>
: Simplify type-erased argument storage
#1907
Conversation
Rename the overload set that emulates the exposition-only constructors of `basic_format_arg` from `_Get_format_arg_storage_type` to `_Phony_basic_format_arg_constructor` for clarity. Encapsulate that overload set - and the traits `_Storage_type` and `_Storage_size` that observe it - in a new class template `_Format_arg_traits`. Remove the bogus `monostate` case and split the floating-point types out from the function template overload to more closely reflect the `basic_format_arg` constructors. Shorten `_Format_arg_store_packed_index` to `_Format_arg_index` and make its converting constructor unconditionally `noexcept`. In `_Format_arg_store`, store indices in an array using the untyped storage only for erased arguments. In `_Store`, reuse `_Format_arg_traits::_Storage_type` instead of trying to duplicate the overload resolution process.
I thought you could store monostates and observe them through |
You can EDIT: I note that we are missing test coverage of |
<format>
: Simplify type-erased argument storage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - I will validate and push changes for ultra-trivial nitpicks.
Thanks for simplifying |
Rename the overload set that emulates the exposition-only constructors of
basic_format_arg
from_Get_format_arg_storage_type
to_Phony_basic_format_arg_constructor
for clarity. Encapsulate that overload set - and the traits_Storage_type
and_Storage_size
that observe it - in a new class template_Format_arg_traits
. Remove the bogusmonostate
case and split the floating-point types out from the function template overload to more closely reflect thebasic_format_arg
constructors.Shorten
_Format_arg_store_packed_index
to_Format_arg_index
and make its converting constructor unconditionallynoexcept
.In
_Format_arg_store
, store indices in an array using the untyped storage only for erased arguments. In_Store
, reuse_Format_arg_traits::_Storage_type
instead of trying to duplicate the overload resolution process.Add test coverage for
visit_format_arg(/**/, basic_format_arg</**/>())
to ensure that themonostate
is properly visitable.