Skip to content

Commit 7dce234

Browse files
committed
Force unsigned division (shift) in lower/upper_bound
1 parent f9c6e64 commit 7dce234

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

ualgo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ ForwardIterator lower_bound (ForwardIterator first, ForwardIterator last, const
368368
{
369369
ForwardIterator mid;
370370
while (first != last) {
371-
mid = advance (first, distance (first,last) / 2);
371+
mid = advance (first, size_t(distance (first,last)) / 2);
372372
if (*mid < value)
373373
first = mid + 1;
374374
else
@@ -396,7 +396,7 @@ ForwardIterator upper_bound (ForwardIterator first, ForwardIterator last, const
396396
{
397397
ForwardIterator mid;
398398
while (first != last) {
399-
mid = advance (first, distance (first,last) / 2);
399+
mid = advance (first, size_t(distance (first,last)) / 2);
400400
if (value < *mid)
401401
last = mid;
402402
else

upredalgo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ ForwardIterator lower_bound (ForwardIterator first, ForwardIterator last, const
207207
{
208208
ForwardIterator mid;
209209
while (first != last) {
210-
mid = advance (first, distance (first,last) / 2);
210+
mid = advance (first, size_t(distance (first,last)) / 2);
211211
if (comp (*mid, value))
212212
first = mid + 1;
213213
else
@@ -237,7 +237,7 @@ ForwardIterator upper_bound (ForwardIterator first, ForwardIterator last, const
237237
{
238238
ForwardIterator mid;
239239
while (first != last) {
240-
mid = advance (first, distance (first,last) / 2);
240+
mid = advance (first, size_t(distance (first,last)) / 2);
241241
if (comp (value, *mid))
242242
last = mid;
243243
else

ustring.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class string : public memblock {
6464
inline string (const_pointer s, size_type len);
6565
inline string (const_pointer s1, const_pointer s2);
6666
string (size_type n, value_type c);
67+
inline ~string (void) noexcept { }
6768
inline pointer data (void) { return (string::pointer (memblock::data())); }
6869
inline const_pointer data (void) const { return (string::const_pointer (memblock::data())); }
6970
inline const_pointer c_str (void) const { return (string::const_pointer (memblock::cdata())); }

0 commit comments

Comments
 (0)