diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2012-05-18 08:59:28 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2012-05-18 08:59:28 +0200 |
| commit | 1cf398c94c1957961a7a4b8fd59f43e554016bf7 (patch) | |
| tree | ec675e74854ceb8006fca01c8a03d212b18210de | |
| parent | 69d3c53462d8c74de3b0eccfee11a9eb60ca26ca (diff) | |
Fix compilation on gcc 4.7
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| -rw-r--r-- | src/mt/mvec.h | 10 | ||||
| -rw-r--r-- | src/net/test.cc | 1 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/mt/mvec.h b/src/mt/mvec.h index 9f31c1e..412f3d7 100644 --- a/src/mt/mvec.h +++ b/src/mt/mvec.h | |||
| @@ -78,16 +78,16 @@ public: | |||
| 78 | int pos=it-map; ins(pos+1,-1); return map+pos; | 78 | int pos=it-map; ins(pos+1,-1); return map+pos; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void push_back(const T& s) { reserve(dim+1); map[dim++]=s; } | ||
| 82 | void pop_back(const T& s) { if(dim) --dim; } | ||
| 83 | |||
| 84 | //////////////////////////////////////////////////////////////// | 81 | //////////////////////////////////////////////////////////////// |
| 85 | 82 | ||
| 86 | void reserve(int n) { | 83 | void reserve(int n) { |
| 87 | if(caps<n) { while(caps<n) caps<<=1; map=(T*)realloc(map,caps*sizeof(T)); } | 84 | if(caps<n) { while(caps<n) caps<<=1; map=(T*)realloc(map,caps*sizeof(T)); } |
| 88 | } | 85 | } |
| 89 | void resize(int n) { reserve(n); dim=n; } | 86 | void resize(int n) { reserve(n); dim=n; } |
| 90 | 87 | ||
| 88 | void push_back(const T& s) { reserve(dim+1); map[dim++]=s; } | ||
| 89 | void pop_back(const T& s) { if(dim) --dim; } | ||
| 90 | |||
| 91 | //////////////////////////////////////////////////////////////// | 91 | //////////////////////////////////////////////////////////////// |
| 92 | 92 | ||
| 93 | protected: | 93 | protected: |
| @@ -130,7 +130,7 @@ public: | |||
| 130 | it->~T(); int pos=it-map; mrvec<T>::ins(pos+1,-1); return map+pos; | 130 | it->~T(); int pos=it-map; mrvec<T>::ins(pos+1,-1); return map+pos; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | void push_back(const T& s) { reserve(dim+1); new(map+dim++) T(s); } | 133 | void push_back(const T& s) { mrvec<T>::reserve(dim+1); new(map+dim++) T(s); } |
| 134 | void pop_back(const T& s) { if(dim) map[--dim].~T(); } | 134 | void pop_back(const T& s) { if(dim) map[--dim].~T(); } |
| 135 | 135 | ||
| 136 | //////////////////////////////////////////////////////////////// | 136 | //////////////////////////////////////////////////////////////// |
diff --git a/src/net/test.cc b/src/net/test.cc index c0e3b41..cb7e46d 100644 --- a/src/net/test.cc +++ b/src/net/test.cc | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #include <mt/mlock.h> | 20 | #include <mt/mlock.h> |
| 21 | #include <unistd.h> | ||
| 21 | #include <iostream> | 22 | #include <iostream> |
| 22 | using namespace std; | 23 | using namespace std; |
| 23 | 24 | ||
