Boost logo

Boost :

Subject: Re: [boost] [system] Would it be possible to trial a breaking change to Boost.System and see what happens?
From: Peter Dimov (lists_at_[hidden])
Date: 2018-01-15 15:20:36


> > I should probably just add the relevant constexpr's to Boost.System.
>
> https://github.com/boostorg/system/commits/feature/constexpr

The only nontrivial change this entails is changing the member relational
operators of error_category:

class error_category
{
public:

    bool operator==(const error_category& rhs) const noexcept;
    bool operator!=(const error_category& rhs) const noexcept;
    bool operator<(const error_category& rhs) const noexcept;
};

into nonmembers:

constexpr bool operator==(const error_category& lhs,
    const error_category& rhs) noexcept;
constexpr bool operator!=(const error_category& lhs,
    const error_category& rhs) noexcept;
bool operator<(const error_category& lhs,
    const error_category& rhs) noexcept;

For the first two, g++ complained that members of a non-literal class can't
be constexpr (whereas clang had no problem with it.) The third one I moved
out for consistency.

Nonmembers seem more idiomatic in either case; can someone think of an
argument against having these out of the class?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk