If I understand how std::error_category
works, it's meant to be a singleton that holds hardcoded messages to be returned when a specific std::error_code
calls the message()
method, internally using that error code to identify which message to return.
My question is how can I use the pair std::error_code
/std::error_category
when the messages I want to return are created dynamically and cannot be cached?
Following this tutorial I'm stuck at overloading make_error_code
so I can pass a string to my child of std::error_category
. Is there an alternative?
Aucun commentaire:
Enregistrer un commentaire