summaryrefslogtreecommitdiffstats
path: root/ml/dlib/dlib/sequence/sequence_compare_1.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:20:02 +0000
commit58daab21cd043e1dc37024a7f99b396788372918 (patch)
tree96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /ml/dlib/dlib/sequence/sequence_compare_1.h
parentReleasing debian version 1.43.2-1. (diff)
downloadnetdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz
netdata-58daab21cd043e1dc37024a7f99b396788372918.zip
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ml/dlib/dlib/sequence/sequence_compare_1.h')
-rw-r--r--ml/dlib/dlib/sequence/sequence_compare_1.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/ml/dlib/dlib/sequence/sequence_compare_1.h b/ml/dlib/dlib/sequence/sequence_compare_1.h
new file mode 100644
index 000000000..9bc3c773d
--- /dev/null
+++ b/ml/dlib/dlib/sequence/sequence_compare_1.h
@@ -0,0 +1,102 @@
+// Copyright (C) 2003 Davis E. King (davis@dlib.net)
+// License: Boost Software License See LICENSE.txt for the full license.
+#ifndef DLIB_SEQUENCE_COMPARe_1_
+#define DLIB_SEQUENCE_COMPARe_1_
+
+#include "sequence_compare_abstract.h"
+
+#include "../algs.h"
+
+
+namespace dlib
+{
+
+ template <
+ typename seq_base
+ >
+ class sequence_compare_1 : public seq_base
+ {
+ typedef typename seq_base::type T;
+
+ public:
+
+ bool operator< (
+ const sequence_compare_1& rhs
+ ) const;
+
+ bool operator== (
+ const sequence_compare_1& rhs
+ ) const;
+
+ };
+
+
+ template <
+ typename seq_base
+ >
+ inline void swap (
+ sequence_compare_1<seq_base>& a,
+ sequence_compare_1<seq_base>& b
+ ) { a.swap(b); }
+
+// ----------------------------------------------------------------------------------------
+// ----------------------------------------------------------------------------------------
+// member function definitions
+// ----------------------------------------------------------------------------------------
+// ----------------------------------------------------------------------------------------
+
+ template <
+ typename seq_base
+ >
+ bool sequence_compare_1<seq_base>::
+ operator< (
+ const sequence_compare_1<seq_base>& rhs
+ ) const
+ {
+ unsigned int length;
+ if (this->size() < rhs.size())
+ length = this->size();
+ else
+ length = rhs.size();
+
+ for (unsigned long i = 0; i < length; ++i)
+ {
+ if ((*this)[i] < rhs[i])
+ return true;
+ else if ( !((*this)[i] == rhs[i]) )
+ return false;
+ }
+ // they are equal so far
+ if (this->size() < rhs.size())
+ return true;
+ else
+ return false;
+ }
+
+// ----------------------------------------------------------------------------------------
+
+ template <
+ typename seq_base
+ >
+ bool sequence_compare_1<seq_base>::
+ operator== (
+ const sequence_compare_1<seq_base>& rhs
+ ) const
+ {
+ if (this->size() != rhs.size())
+ return false;
+
+ for (unsigned long i = 0; i < this->size(); ++i)
+ {
+ if (!((*this)[i] == rhs[i]))
+ return false;
+ }
+ return true;
+ }
+
+// ----------------------------------------------------------------------------------------
+
+}
+
+#endif // DLIB_SEQUENCE_COMPARe_1_
+