jeudi 24 août 2017

Do we really need std::error_category and std::error_condition?

So, on my journey to understand how std::error_code works I'm starting to wonder if we really need std::error_condition and std::error_category. I'm trying to implement what's in this and this tutorial and the amount of work is non-trivial along with it being fairly fragile (I'm currently stuck trying to figure out why this code causes linking errors with duplicate symbols.

Isn't it easier to subclass std::error_code, add a message property & method and then let std::error_code be comparable to an enum where error codes are defined? I'm struggling to understand why I need std::error_category and std::error_condition at all.

Aucun commentaire:

Enregistrer un commentaire