summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include/string
diff options
context:
space:
mode:
authortheraven <theraven@FreeBSD.org>2012-03-14 00:09:36 +0000
committertheraven <theraven@FreeBSD.org>2012-03-14 00:09:36 +0000
commit7bd22d0949674b61e2c1a97cbb6caeeb5ab7fd19 (patch)
tree077f044b08d256dd8348f977fe56d18c08fccd78 /contrib/libc++/include/string
parentd83b894ff4280333de5ef40496cfd061b515ba54 (diff)
parentbaa75b9984d33ea49ffb76a73507b64d879166cc (diff)
downloadFreeBSD-src-7bd22d0949674b61e2c1a97cbb6caeeb5ab7fd19.zip
FreeBSD-src-7bd22d0949674b61e2c1a97cbb6caeeb5ab7fd19.tar.gz
Import new versions of libcxxrt and libc++.
Please tests any C++ code you care about with -stdlib=libc++! Approved by: dim (mentor)
Diffstat (limited to 'contrib/libc++/include/string')
-rw-r--r--contrib/libc++/include/string36
1 files changed, 17 insertions, 19 deletions
diff --git a/contrib/libc++/include/string b/contrib/libc++/include/string
index 5f5a347..620e6f8 100644
--- a/contrib/libc++/include/string
+++ b/contrib/libc++/include/string
@@ -446,6 +446,8 @@ template <> struct hash<wstring>;
#include <cassert>
#endif
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -1077,7 +1079,7 @@ private:
enum {__long_mask = ~(size_type(~0) >> 1)};
#else // _LIBCPP_BIG_ENDIAN
enum {__short_mask = 0x01};
- enum {__long_mask = 0x1};
+ enum {__long_mask = 0x1ul};
#endif // _LIBCPP_BIG_ENDIAN
enum {__mask = size_type(~0) >> 1};
@@ -1499,7 +1501,7 @@ private:
{__r_.first().__l.__cap_ = __long_mask | __s;}
_LIBCPP_INLINE_VISIBILITY
size_type __get_long_cap() const _NOEXCEPT
- {return __r_.first().__l.__cap_ & ~__long_mask;}
+ {return __r_.first().__l.__cap_ & size_type(~__long_mask);}
_LIBCPP_INLINE_VISIBILITY
void __set_long_pointer(pointer __p) _NOEXCEPT
@@ -1589,7 +1591,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const basic_string& __str, false_type) _NOEXCEPT
+ void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1617,7 +1619,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(basic_string& __c, false_type)
+ void __move_assign_alloc(basic_string&, false_type)
_NOEXCEPT
{}
@@ -1636,7 +1638,7 @@ private:
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
- static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) _NOEXCEPT
+ static void __swap_alloc(allocator_type&, allocator_type&, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
@@ -1667,7 +1669,11 @@ template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
#endif
void
-basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)
+basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
+#ifdef _LIBCPP_DEBUG
+ __pos
+#endif
+ )
{
#ifdef _LIBCPP_DEBUG
const_iterator __beg = begin();
@@ -2783,7 +2789,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
iterator __b = begin();
size_type __r = static_cast<size_type>(__pos - __b);
erase(__r, 1);
- return __b + __r;
+ return __b + static_cast<difference_type>(__r);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -2794,7 +2800,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i
iterator __b = begin();
size_type __r = static_cast<size_type>(__first - __b);
erase(__r, static_cast<size_type>(__last - __first));
- return __b + __r;
+ return __b + static_cast<difference_type>(__r);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3481,7 +3487,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
template <class _CharT, class _Traits, class _Allocator>
int
-basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const
+basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const _NOEXCEPT
{
#ifdef _LIBCPP_DEBUG
assert(__s != 0);
@@ -3909,16 +3915,8 @@ template<class _CharT, class _Traits, class _Allocator>
template<class _Ptr>
size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e)
{
- size_t __r = 0;
- const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
- const size_t __m = size_t(0xF) << (__sr + 4);
- for (; __p != __e; ++__p)
- {
- __r = (__r << 4) + *__p;
- size_t __g = __r & __m;
- __r ^= __g | (__g >> __sr);
- }
- return __r;
+ typedef typename iterator_traits<_Ptr>::value_type value_type;
+ return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type));
}
template<class _CharT, class _Traits, class _Allocator>
OpenPOWER on IntegriCloud