Boost logo

Boost :

Subject: Re: [boost] [system] The new Boost.System is now ready
From: Peter Dimov (lists_at_[hidden])
Date: 2018-10-07 14:24:47


Bjorn Reese wrote:
> On 10/05/18 00:37, Peter Dimov via Boost wrote:
>
> >> - identifier-based category comparison
> >
> > https://pdimov.github.io/cpp-papers/P1196R0.html
>
> This states in Motivation that
>
> "relying on address-based comparisons makes it impossible to declare
> category objects constexpr and makes it impossible to declare
> operator< constexpr"
>
> Implementation adds the constexpr to operator<
>
> "constexpr bool operator<(const error_category& rhs) const noexcept;"
>
> with an as-if comment about the return value, which ends with an address
> comparison:
>
> "return less<const error_category*>()(this, &rhs);"
>
> How can this be made constexpr?

It's constexpr if you never reach this line. That is, if at least one of the
categories you're comparing has an identifier, op< is constexpr.

> >> - message() into a caller-supplied buffer
> >
> > https://pdimov.github.io/cpp-papers/P1197R0.html
>
> This document refers to strerror_r as a glibc thing. It is also Posix,
> which is probably a better reference:
>
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html

I'm referring specifically to the Glibc version, which returns `char const*`
so that the implementation can return literals instead of using the buffer.

The POSIX version returns an `int` and always copies into the buffer.


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