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
|
From d0a006ad2fcabd1e785787b9a5c84b32edbab780 Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@gmail.com>
Date: Tue, 7 Jan 2014 15:43:36 -0500
Subject: [PATCH] Add a method to set empty to a span of elements.
---
include/mdds/multi_type_matrix.hpp | 9 +++++++++
include/mdds/multi_type_matrix_def.inl | 10 ++++++++++
2 files changed, 19 insertions(+)
diff --git a/include/mdds/multi_type_matrix.hpp b/include/mdds/multi_type_matrix.hpp
index a30393f..0574466 100644
--- a/include/mdds/multi_type_matrix.hpp
+++ b/c/d/include/mdds/multi_type_matrix.hpp
@@ -377,6 +377,15 @@ public:
void set_empty(size_type row, size_type col);
/**
+ * Set specified range of elements empty.
+ *
+ * @param row row position of the first element.
+ * @param col column position of the first element.
+ * @param length length of the range to set empty.
+ */
+ void set_empty(size_type row, size_type col, size_type length);
+
+ /**
* Set element referenced by the position object empty.
*
* @param pos position object that references element.
diff --git a/include/mdds/multi_type_matrix_def.inl b/include/mdds/multi_type_matrix_def.inl
index 21fe866..36f5448 100644
--- a/include/mdds/multi_type_matrix_def.inl
+++ b/c/d/include/mdds/multi_type_matrix_def.inl
@@ -240,6 +240,16 @@ void multi_type_matrix<_String>::set_empty(size_type row, size_type col)
}
template<typename _String>
+void multi_type_matrix<_String>::set_empty(size_type row, size_type col, size_type length)
+{
+ if (length == 0)
+ throw general_error("multi_type_matrix::set_empty: length of zero is not permitted.");
+
+ size_type pos1 = get_pos(row, col);
+ m_store.set_empty(pos1, pos1+length-1);
+}
+
+template<typename _String>
typename multi_type_matrix<_String>::position_type
multi_type_matrix<_String>::set_empty(const position_type& pos)
{
--
1.8.1.4
|