summaryrefslogtreecommitdiff
path: root/external/mdds/0001-another-step-to-allow-fst-to-use-any-value-type.patch.1
blob: bed9c9cb750c2d1d3e7606d38d283dce42bee45b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 5fc9214fb94595e1a2c0b9e0285037f5a2fa59bf Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Mon, 29 Jun 2015 14:28:42 +0200
Subject: [PATCH] another step to allow fst to use any value type

For some reason this is not a problem on modern compilers...
---
 include/mdds/flat_segment_tree.hpp     | 1 -
 include/mdds/flat_segment_tree_def.inl | 2 +-
 src/flat_segment_tree_test.cpp         | 4 ++++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/mdds/flat_segment_tree.hpp b/include/mdds/flat_segment_tree.hpp
index b656bc3..02cf87e 100644
--- a/include/mdds/flat_segment_tree.hpp
+++ b/include/mdds/flat_segment_tree.hpp
@@ -32,7 +32,6 @@
 #include <sstream>
 #include <utility>
 #include <cassert>
-#include <limits>
 
 #include "mdds/node.hpp"
 #include "mdds/flat_segment_tree_itr.hpp"
diff --git a/include/mdds/flat_segment_tree_def.inl b/include/mdds/flat_segment_tree_def.inl
index ebfee99..5fef1c3 100644
--- a/include/mdds/flat_segment_tree_def.inl
+++ b/include/mdds/flat_segment_tree_def.inl
@@ -46,7 +46,7 @@ flat_segment_tree<_Key, _Value>::flat_segment_tree(key_type min_val, key_type ma
     // We don't ever use the value of the right leaf node, but we need the
     // value to be always the same, to make it easier to check for
     // equality.
-    m_right_leaf->value_leaf.value = ::std::numeric_limits<value_type>::max();
+    m_right_leaf->value_leaf.value = init_val;
 }
 
 template<typename _Key, typename _Value>
diff --git a/src/flat_segment_tree_test.cpp b/src/flat_segment_tree_test.cpp
index 81858f5..f7aead7 100644
--- a/src/flat_segment_tree_test.cpp
+++ b/src/flat_segment_tree_test.cpp
@@ -1943,6 +1943,10 @@ void fst_test_non_numeric_value()
     db.search(1, result);
 
     assert(result == "hello world");
+
+    db_type db2(db);
+
+    assert(db == db2);
 }
 
 void fst_test_non_numeric_key()
-- 
2.4.2