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

question about missing basic_format_args constructor in v11 #4045

Closed
odygrd opened this issue Jul 1, 2024 · 1 comment
Closed

question about missing basic_format_args constructor in v11 #4045

odygrd opened this issue Jul 1, 2024 · 1 comment
Labels

Comments

@odygrd
Copy link

odygrd commented Jul 1, 2024

Hello, I used to have some code like the following in v10 :

    unsigned long long get_arg_types() const
    {
      return fmt::detail::is_unpacked_bit | _data.size();
    }
    
    fmt::basic_format_arg<fmt::format_context> const* get_arg_data() const
    {
      return _data.data();
    }
    
    std::string formatted_values_str;
    std::string format_string;

    fmt::vformat_to(std::back_inserter(formatted_values_str), format_string,
                         fmt::basic_format_args<fmt::format_context>{
                           get_arg_types(), get_arg_data()});

It seems that in v11 this basic_format_args constructor has been removed

constexpr basic_format_args(unsigned long long desc, const format_arg* args)
   : desc_(desc), args_(args) {}

Is there any alternative I can use in v11 to achieve similar result ?

@odygrd
Copy link
Author

odygrd commented Jul 1, 2024

I have switched to using the below ctor and it seems good, thank you for your work !

  constexpr basic_format_args(const format_arg* args, int count)
      : desc_(detail::is_unpacked_bit | detail::to_unsigned(count)),
        args_(args) {}

@odygrd odygrd closed this as completed Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants