These are chat archives for boostorg/hana

Sep 2016
Sep 27 2016 14:24
Hi, the following code requires operator!= defined to compile with clang 3.7.0. Is it intended?
#include <boost/hana.hpp>
namespace hana = boost::hana;

struct S
 bool operator==(const S& s) const { return true; }
// bool operator!=(const S& s) const { return false; } //uncomment to compile

int main() {
            hana::make_pair(hana::char_c<'a'>, S())
            hana::make_pair(hana::char_c<'a'>, S())
Louis Dionne
Sep 27 2016 15:53
Yes, this is expected. Your type is not EqualityComparable, so Hana can’t provide a default model of Comparable for it.
I have made the error message that you get more explicit about the possible cause for this failure. See boostorg/hana@14bb149.
That being said, I think the rules for cross-type operations (which includes comparison) are overly complicated in Hana, and this is something I look forward to change in a future major version (this is a breaking change).
Also, be aware that you should return boolean integral constants from your comparison operators whenever that is possible.