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

Overload operator "<<" for customized_id to support formatting by {fmt} #1220

Closed
empiredan opened this issue Nov 3, 2022 · 0 comments
Closed
Labels
type/enhancement Indicates new feature requests

Comments

@empiredan
Copy link
Contributor

empiredan commented Nov 3, 2022

Some classes such as rpc_channel are based on template class customized_id. Currently they can only be formatted by {fmt} using to_string(). For example, in src/runtime/rpc/asio_net_provider.cpp, there are codes as below:

    CHECK(channel == RPC_CHANNEL_TCP || channel == RPC_CHANNEL_UDP,
          "invalid given channel {}",
          channel.to_string());

In src/runtime/rpc/network.sim.cpp:

    CHECK(channel == RPC_CHANNEL_TCP || channel == RPC_CHANNEL_UDP,
          "invalid given channel {}",
          channel.to_string());

To simplify the formatting, operator << can just be overloaded which is supported by {fmt}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

1 participant