|
Boost Users : |
Subject: Re: [Boost-users] Compare boost::system::error_category
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-03-25 23:24:32
On 25/03/2017 23:05, Christopher Pisz via Boost-users wrote:
> What would be so wrong with category being an actual number to
> compare against?
>
> I don't know anyone whom creates classes and operator == using the
> address of that class. You guys talk about the standard and what
> not, and admittedly I've never looked inside how they implement
> things, but I've never had such problems using the STL either.
C++ 14 standard subsection 19.5.1.1:
"error_category objects are passed by reference, and two such objects
are equal if they have the same address. This means that applications
using custom error_category types should create a single object of each
such type."
Indeed subsection 19.5.1.3 explicitly says that the comparison operator
returns (this == &rhs). That puts standard library implementators in a bind.
Niall
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net