diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-08-07 13:53:00 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-02-12 06:49:39 -0500 |
commit | 2e2370a21d65ee9ea7659f995fc5b553885646fc (patch) | |
tree | 7db285fccf0e246bd53da8f4703f3af2cdf2a5e7 | |
parent | 6bd218ab3d181a6295de0da88489abe40ffd3cec (diff) |
Simplify sharedres_types.h with iterator macros
Explicit iterator handling is cumbersome. Hide it when possible.
-rw-r--r-- | native/include/sharedres_types.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/native/include/sharedres_types.h b/native/include/sharedres_types.h index 17fda46..fe190c6 100644 --- a/native/include/sharedres_types.h +++ b/native/include/sharedres_types.h | |||
@@ -7,6 +7,8 @@ | |||
7 | 7 | ||
8 | #include <vector> | 8 | #include <vector> |
9 | #include <algorithm> | 9 | #include <algorithm> |
10 | |||
11 | #include "stl-helper.h" | ||
10 | #endif | 12 | #endif |
11 | 13 | ||
12 | typedef enum { | 14 | typedef enum { |
@@ -101,10 +103,7 @@ public: | |||
101 | unsigned int get_total_num_requests() const | 103 | unsigned int get_total_num_requests() const |
102 | { | 104 | { |
103 | unsigned int count = 0; | 105 | unsigned int count = 0; |
104 | Requests::const_iterator it; | 106 | foreach(requests, it) |
105 | for (it = requests.begin(); | ||
106 | it != requests.end(); | ||
107 | it++) | ||
108 | count += it->get_num_requests(); | 107 | count += it->get_num_requests(); |
109 | return count; | 108 | return count; |
110 | } | 109 | } |
@@ -112,10 +111,7 @@ public: | |||
112 | unsigned int get_max_request_length() const | 111 | unsigned int get_max_request_length() const |
113 | { | 112 | { |
114 | unsigned int len = 0; | 113 | unsigned int len = 0; |
115 | Requests::const_iterator it; | 114 | foreach(requests, it) |
116 | for (it = requests.begin(); | ||
117 | it != requests.end(); | ||
118 | it++) | ||
119 | len = std::max(len, it->get_request_length()); | 115 | len = std::max(len, it->get_request_length()); |
120 | return len; | 116 | return len; |
121 | } | 117 | } |