@@ -150,15 +150,18 @@ The valid values are:
150150 " __int__" ,
151151 [](Undefined const & x) -> size_t { return static_cast <size_t >(x); })
152152 .def (" __chr__" ,
153- [](Undefined const & x) -> char { return static_cast <char >(x); });
153+ [](Undefined const & x) -> char { return static_cast <char >(x); })
154+ .def (" __hash__" , [](Undefined const & op) -> int {
155+ return std::hash<uint64_t >{}(static_cast <uint64_t >(op));
156+ });
154157
155158 m.attr (" UNDEFINED" ) = UNDEFINED;
156159
157160#ifdef LIBSEMIGROUPS_EIGEN_ENABLED
158161 m.attr (" LIBSEMIGROUPS_EIGEN_ENABLED" )
159162 = static_cast <bool >(LIBSEMIGROUPS_EIGEN_ENABLED);
160163#else
161- m.attr (" LIBSEMIGROUPS_EIGEN_ENABLED" ) = false ;
164+ m.attr (" LIBSEMIGROUPS_EIGEN_ENABLED" ) = false ;
162165#endif
163166
164167#ifdef LIBSEMIGROUPS_HPCOMBI_ENABLED
@@ -253,7 +256,7 @@ The valid values are:
253256#ifdef VERSION_INFO
254257 m.attr (" __version__" ) = VERSION_INFO;
255258#else
256- m.attr (" __version__" ) = " dev" ;
259+ m.attr (" __version__" ) = " dev" ;
257260#endif
258261
259262 // //////////////////////////////////////////////////////////////////////
@@ -351,8 +354,12 @@ default.
351354 return lhop == rhop;
352355 },
353356 py::is_operator ())
354- .def (" to_int" , [](PositiveInfinity const & x) -> int64_t {
355- return static_cast <int64_t >(x);
357+ .def (" to_int" ,
358+ [](PositiveInfinity const & x) -> int64_t {
359+ return static_cast <int64_t >(x);
360+ })
361+ .def (" __hash__" , [](PositiveInfinity const & op) -> int {
362+ return std::hash<uint64_t >{}(static_cast <uint64_t >(op));
356363 });
357364
358365 m.attr (" POSITIVE_INFINITY" ) = POSITIVE_INFINITY;
@@ -395,8 +402,12 @@ default.
395402 return lhop == rhop;
396403 },
397404 py::is_operator ())
398- .def (" to_int" , [](NegativeInfinity const & x) -> int64_t {
399- return static_cast <int64_t >(x);
405+ .def (" to_int" ,
406+ [](NegativeInfinity const & x) -> int64_t {
407+ return static_cast <int64_t >(x);
408+ })
409+ .def (" __hash__" , [](NegativeInfinity const & op) -> int {
410+ return std::hash<int64_t >{}(static_cast <int64_t >(op));
400411 });
401412
402413 m.attr (" NEGATIVE_INFINITY" ) = NEGATIVE_INFINITY;
@@ -444,7 +455,10 @@ default.
444455 [](LimitMax const & rhs, int64_t lhs) { return lhs - rhs; },
445456 py::is_operator ())
446457 .def (" to_int" ,
447- [](LimitMax const & x) -> int { return static_cast <int >(x); });
458+ [](LimitMax const & x) -> int { return static_cast <int >(x); })
459+ .def (" __hash__" , [](LimitMax const & op) -> int {
460+ return std::hash<uint64_t >{}(static_cast <uint64_t >(op));
461+ });
448462
449463 m.attr (" LIMIT_MAX" ) = LIMIT_MAX;
450464
0 commit comments