瀏覽代碼

fix: Not constraint was not working correctly

Sam Jaffe 3 月之前
父節點
當前提交
69e97cb0ee
共有 2 個文件被更改,包括 2 次插入1 次删除
  1. 1 1
      include/jvalidate/forward.h
  2. 1 0
      include/jvalidate/schema.h

+ 1 - 1
include/jvalidate/forward.h

@@ -173,7 +173,7 @@ concept Visitable = Adapter<A> && requires(V & v, E const & c, A const & doc, B
 };
 
 template <typename T, typename S>
-concept Not = not std::is_convertible_v<std::decay_t<S>, T>;
+concept Not = not std::is_same_v<std::decay_t<T>, std::decay_t<S>>;
 }
 
 namespace jvalidate {

+ 1 - 0
include/jvalidate/schema.h

@@ -210,6 +210,7 @@ public:
    * into an Adapter object to allow us to walk through it w/o specialization.
    */
   template <typename JSON, typename... Args>
+    requires(not Adapter<JSON>)
   explicit Schema(JSON const & json, Args &&... args)
       : Schema(adapter::AdapterFor<JSON const>(json), std::forward<Args>(args)...) {}