kerf icon indicating copy to clipboard operation
kerf copied to clipboard

no member named 'is_eq' in namespace 'std'

Open 0ihsan opened this issue 3 years ago • 2 comments

clang++ -w -L/opt/homebrew/lib -I/opt/homebrew/include -std=c++2b -pthread -ledit -levent -O0 -DDEBUG -g -lgtest -fsanitize=address main.cc
In file included from main.cc:1:
In file included from ./kerf.h:295:
./slop.h:971:17: error: no member named 'is_eq' in namespace 'std'
    return std::is_eq(compare(x));
           ~~~~~^
./slop.h:975:70: error: no member named 'is_eq' in namespace 'std'
  friend bool operator== (const SLOP& a, const SLOP& b) {return std::is_eq(a<=>b); }
                                                                ~~~~~^
In file included from main.cc:1:
In file included from ./kerf.h:321:
./grade.cc:103:13: error: no member named 'is_neq' in namespace 'std'
    if(std::is_neq(cc)) return cc;
       ~~~~~^
./grade.cc:110:92: error: no member named 'is_neq' in namespace 'std'
    auto g = [&](const SLOP& a, const SLOP& b) { c = a.compare(b); early_break_flag = std::is_neq(c);};
                                                                                      ~~~~~^
4 errors generated.

on m1 chip

0ihsan avatar Aug 24 '22 10:08 0ihsan

The fixes for these are as follows:

slop.h
  return 0 == compare(x);// std::is_eq(compare(x));
  friend bool operator== (const SLOP& a, const SLOP& b) {return 0 == (a<=>b); } // std::is_eq(a<=>b); }
grade.cc
  if(0 != cc) return cc; // if(std::is_neq(cc)) return cc;
  auto g = [&](const SLOP& a, const SLOP& b) { c = a.compare(b); early_break_flag = (0 !=c);};  // std::is_neq(c);};

I think something changed with respect to the std::is_eq family in c++2b.

kevinlawler avatar Aug 24 '22 12:08 kevinlawler

thanks, that fixed it.

here is a patch of the change for those looking for a quicker way. git apply x.patch

diff --git a/grade.cc b/grade.cc
index f657210..0ecde9c 100644
--- a/grade.cc
+++ b/grade.cc
@@ -100,14 +100,14 @@ std::weak_ordering PRESENTED_BASE::compare(const SLOP& x)
     // }
 
     auto cc = parent()->countI() <=> x.countI();
-    if(std::is_neq(cc)) return cc;
+    if (0 != cc) return cc; // if(std::is_neq(cc)) return cc;
 
     // Question. So all empty lists are equal then, regardless of type? Answer. Yes, because representational type
 
     auto c = std::weak_ordering::equivalent;
     bool early_break_flag = false;
 
-    auto g = [&](const SLOP& a, const SLOP& b) { c = a.compare(b); early_break_flag = std::is_neq(c);};
+    auto g = [&](const SLOP& a, const SLOP& b) { c = a.compare(b); early_break_flag = (0 != c);};  // std::is_neq(c);};
     parent()->iterator_duplex_presented_subslop(g, x, &early_break_flag);
 
     return c;
diff --git a/slop.h b/slop.h
index fc9b87e..41979f2 100644
--- a/slop.h
+++ b/slop.h
@@ -968,11 +968,11 @@ struct SLOP {
   bool match(const SLOP& x) const
   {
     // TODO: exact floating point? hash thingies?
-    return std::is_eq(compare(x));
+    return 0 == compare(x);
   }
 
   friend auto operator<=>(const SLOP& a, const SLOP& b) {return a.compare(b); } 
-  friend bool operator== (const SLOP& a, const SLOP& b) {return std::is_eq(a<=>b); } 
+  friend bool operator== (const SLOP& a, const SLOP& b) {return 0 == (a<=>b); }
 
 #pragma mark - Cast Operators

0ihsan avatar Aug 24 '22 12:08 0ihsan