[cfe-dev] std::error_category not extensible?

Gordon Henriksen gordonhenriksen at me.com
Sun Dec 16 18:29:19 PST 2012


We have a reasonably large body of code using std::error_category subclasses on Visual C++. With libc++, error_category::error_category() is private, preventing this code from porting. Was there a late decision by the standards committee to redact system_error extensibility...?

— Gordon




class _LIBCPP_VISIBLE error_category
{
public:
    virtual ~error_category() _NOEXCEPT;

private:
    error_category() _NOEXCEPT;
    error_category(const error_category&);// = delete;
    error_category& operator=(const error_category&);// = delete;

public:
    virtual const char* name() const _NOEXCEPT = 0;
    virtual error_condition default_error_condition(int __ev) const _NOEXCEPT;
    virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT;
    virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT;
    virtual string message(int __ev) const = 0;

    _LIBCPP_ALWAYS_INLINE
    bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;}

    _LIBCPP_ALWAYS_INLINE
    bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);}

    _LIBCPP_ALWAYS_INLINE
    bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}

    friend class __do_message;
};

class _LIBCPP_HIDDEN __do_message
    : public error_category
{
public:
    virtual string message(int ev) const;
};









More information about the cfe-dev mailing list