Browse Source

LibCrypto: Add the BigInteger concept

This makes it much easier to write (template) functions that accept
either a signed or unsigned bigint parameter.
Linus Groh 3 năm trước cách đây
mục cha
commit
0c424c4dab
1 tập tin đã thay đổi với 19 bổ sung0 xóa
  1. 19 0
      Userland/Libraries/LibCrypto/Forward.h

+ 19 - 0
Userland/Libraries/LibCrypto/Forward.h

@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Concepts.h>
+
+namespace Crypto {
+
+class SignedBigInteger;
+class UnsignedBigInteger;
+
+template<typename T>
+concept BigInteger = IsSame<T, SignedBigInteger> || IsSame<T, UnsignedBigInteger>;
+
+}