diff options
Diffstat (limited to 'gcc-4.9/libstdc++-v3/include/bits')
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/algorithmfwd.h | 12 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/atomic_base.h | 5 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/basic_string.h | 2 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/hashtable.h | 2 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/move.h | 5 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/regex.h | 137 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/regex.tcc | 106 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/regex_compiler.tcc | 2 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/regex_executor.tcc | 35 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/stl_algo.h | 16 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/stl_algobase.h | 3 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/stl_function.h | 4 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/stl_queue.h | 3 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/stl_stack.h | 3 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/stl_uninitialized.h | 5 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/unique_ptr.h | 3 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/bits/vector.tcc | 2 |
17 files changed, 185 insertions, 160 deletions
diff --git a/gcc-4.9/libstdc++-v3/include/bits/algorithmfwd.h b/gcc-4.9/libstdc++-v3/include/bits/algorithmfwd.h index aee1eec..c67ecfe 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/algorithmfwd.h +++ b/gcc-4.9/libstdc++-v3/include/bits/algorithmfwd.h @@ -482,11 +482,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _FIter, typename _Tp> _FIter - remove(_FIter, _FIter, const _Tp&); + remove(_FIter, _FIter, const _Tp&) + __attribute__ ((warn_unused_result)); template<typename _FIter, typename _Predicate> _FIter - remove_if(_FIter, _FIter, _Predicate); + remove_if(_FIter, _FIter, _Predicate) + __attribute__ ((warn_unused_result)); template<typename _IIter, typename _OIter, typename _Tp> _OIter @@ -574,11 +576,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _FIter> _FIter - unique(_FIter, _FIter); + unique(_FIter, _FIter) + __attribute__ ((warn_unused_result)); template<typename _FIter, typename _BinaryPredicate> _FIter - unique(_FIter, _FIter, _BinaryPredicate); + unique(_FIter, _FIter, _BinaryPredicate) + __attribute__ ((warn_unused_result)); // unique_copy diff --git a/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h b/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h index 1fc0ebb..ceead01 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h +++ b/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h @@ -355,7 +355,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: typedef _ITp __int_type; - __int_type _M_i; + static constexpr int _S_alignment = + sizeof(_ITp) > alignof(_ITp) ? sizeof(_ITp) : alignof(_ITp); + + alignas(_S_alignment) __int_type _M_i; public: __atomic_base() noexcept = default; diff --git a/gcc-4.9/libstdc++-v3/include/bits/basic_string.h b/gcc-4.9/libstdc++-v3/include/bits/basic_string.h index 93ceb6d..8918965 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/basic_string.h +++ b/gcc-4.9/libstdc++-v3/include/bits/basic_string.h @@ -3140,6 +3140,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus > 201103L +#define __cpp_lib_string_udls 201304 + inline namespace literals { inline namespace string_literals diff --git a/gcc-4.9/libstdc++-v3/include/bits/hashtable.h b/gcc-4.9/libstdc++-v3/include/bits/hashtable.h index 588e69c..894e526 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/hashtable.h +++ b/gcc-4.9/libstdc++-v3/include/bits/hashtable.h @@ -326,7 +326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _M_uses_single_bucket(__bucket_type* __bkts) const - { return __builtin_expect(_M_buckets == &_M_single_bucket, false); } + { return __builtin_expect(__bkts == &_M_single_bucket, false); } bool _M_uses_single_bucket() const diff --git a/gcc-4.9/libstdc++-v3/include/bits/move.h b/gcc-4.9/libstdc++-v3/include/bits/move.h index dc4ac0f..512bb79 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/move.h +++ b/gcc-4.9/libstdc++-v3/include/bits/move.h @@ -39,10 +39,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Used, in C++03 mode too, by allocators, etc. /** - * @brief Same as C++11 std::addressof + * @brief Same as C++11 std::addressof, except it is constexpr in C++11. * @ingroup utilities */ template<typename _Tp> +#if __cplusplus >= 201103L + constexpr +#endif inline _Tp* __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT { diff --git a/gcc-4.9/libstdc++-v3/include/bits/regex.h b/gcc-4.9/libstdc++-v3/include/bits/regex.h index e556350..b358c79 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/regex.h +++ b/gcc-4.9/libstdc++-v3/include/bits/regex.h @@ -474,17 +474,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * * @param __rhs A @p regex object. */ - basic_regex(const basic_regex& __rhs) = default; + basic_regex(const basic_regex& __rhs) + : _M_flags(__rhs._M_flags), _M_original_str(__rhs._M_original_str) + { + _M_traits.imbue(__rhs.getloc()); + this->assign(_M_original_str, _M_flags); + } /** * @brief Move-constructs a basic regular expression. * * @param __rhs A @p regex object. + * + * The implementation is a workaround concerning ABI compatibility. See: + * https://gcc.gnu.org/ml/libstdc++/2014-09/msg00067.html */ - basic_regex(const basic_regex&& __rhs) noexcept - : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits), - _M_automaton(std::move(__rhs._M_automaton)) - { } + basic_regex(basic_regex&& __rhs) + : _M_flags(__rhs._M_flags), + _M_original_str(std::move(__rhs._M_original_str)) + { + _M_traits.imbue(__rhs.getloc()); + this->assign(_M_original_str, _M_flags); + __rhs._M_automaton.reset(); + } /** * @brief Constructs a basic regular expression from the string @@ -555,9 +567,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Move-assigns one regular expression to another. + * + * The implementation is a workaround concerning ABI compatibility. See: + * https://gcc.gnu.org/ml/libstdc++/2014-09/msg00067.html */ basic_regex& - operator=(basic_regex&& __rhs) noexcept + operator=(basic_regex&& __rhs) { return this->assign(std::move(__rhs)); } /** @@ -591,8 +606,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_regex& assign(const basic_regex& __rhs) { - basic_regex __tmp(__rhs); - this->swap(__tmp); + _M_flags = __rhs._M_flags; + _M_original_str = __rhs._M_original_str; + _M_traits.imbue(__rhs.getloc()); + this->assign(_M_original_str, _M_flags); return *this; } @@ -600,12 +617,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @brief The move-assignment operator. * * @param __rhs Another regular expression object. + * + * The implementation is a workaround concerning ABI compatibility. See: + * https://gcc.gnu.org/ml/libstdc++/2014-09/msg00067.html */ basic_regex& - assign(basic_regex&& __rhs) noexcept + assign(basic_regex&& __rhs) { - basic_regex __tmp(std::move(__rhs)); - this->swap(__tmp); + _M_flags = __rhs._M_flags; + _M_original_str = std::move(__rhs._M_original_str); + __rhs._M_automaton.reset(); + _M_traits.imbue(__rhs.getloc()); + this->assign(_M_original_str, _M_flags); return *this; } @@ -659,12 +682,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION assign(const basic_string<_Ch_type, _Ch_typeraits, _Alloc>& __s, flag_type __flags = ECMAScript) { + _M_automaton = __detail::__compile_nfa( + __s.data(), __s.data() + __s.size(), _M_traits, __flags); + _M_original_str = __s; _M_flags = __flags; - _M_original_str.assign(__s.begin(), __s.end()); - auto __p = _M_original_str.c_str(); - _M_automaton = __detail::__compile_nfa(__p, - __p + _M_original_str.size(), - _M_traits, _M_flags); return *this; } @@ -709,7 +730,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ unsigned int mark_count() const - { return _M_automaton->_M_sub_count() - 1; } + { + if (_M_automaton) + return _M_automaton->_M_sub_count() - 1; + return 0; + } /** * @brief Gets the flags used to construct the regular expression @@ -728,9 +753,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION locale_type imbue(locale_type __loc) { - auto __ret = _M_traits.imbue(__loc); - this->assign(_M_original_str, _M_flags); - return __ret; + _M_automaton = nullptr; + return _M_traits.imbue(__loc); } /** @@ -752,7 +776,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { std::swap(_M_flags, __rhs._M_flags); std::swap(_M_traits, __rhs._M_traits); - std::swap(_M_automaton, __rhs._M_automaton); + auto __tmp = std::move(_M_original_str); + this->assign(__rhs._M_original_str, _M_flags); + __rhs.assign(__tmp, __rhs._M_flags); } #ifdef _GLIBCXX_DEBUG @@ -761,7 +787,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _M_automaton->_M_dot(__ostr); } #endif - protected: + private: typedef std::shared_ptr<__detail::_NFA<_Rx_traits>> _AutomatonPtr; template<typename _Bp, typename _Ap, typename _Cp, typename _Rp, @@ -1552,42 +1578,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ explicit match_results(const _Alloc& __a = _Alloc()) - : _Base_type(__a), _M_in_iterator(false) + : _Base_type(__a) { } /** * @brief Copy constructs a %match_results. */ - match_results(const match_results& __rhs) - : _Base_type(__rhs), _M_in_iterator(false) - { } + match_results(const match_results& __rhs) = default; /** * @brief Move constructs a %match_results. */ - match_results(match_results&& __rhs) noexcept - : _Base_type(std::move(__rhs)), _M_in_iterator(false) - { } + match_results(match_results&& __rhs) noexcept = default; /** * @brief Assigns rhs to *this. */ match_results& - operator=(const match_results& __rhs) - { - match_results(__rhs).swap(*this); - return *this; - } + operator=(const match_results& __rhs) = default; /** * @brief Move-assigns rhs to *this. */ match_results& - operator=(match_results&& __rhs) - { - match_results(std::move(__rhs)).swap(*this); - return *this; - } + operator=(match_results&& __rhs) = default; /** * @brief Destroys a %match_results object. @@ -1674,13 +1688,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION difference_type position(size_type __sub = 0) const { - // [28.12.1.4.5] - if (_M_in_iterator) - return __sub < size() ? std::distance(_M_begin, - (*this)[__sub].first) : -1; - else - return __sub < size() ? std::distance(this->prefix().first, - (*this)[__sub].first) : -1; + return __sub < size() ? std::distance(_M_begin, + (*this)[__sub].first) : -1; } /** @@ -1762,7 +1771,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ const_iterator cbegin() const - { return _Base_type::cbegin() + 2; } + { return this->begin(); } /** * @brief Gets an iterator to one-past-the-end of the collection. @@ -1776,7 +1785,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ const_iterator cend() const - { return _Base_type::cend(); } + { return this->end(); } //@} @@ -1814,7 +1823,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @pre ready() == true */ - template<typename _Out_iter, typename _St, typename _Sa> + template<typename _St, typename _Sa> basic_string<char_type, _St, _Sa> format(const basic_string<char_type, _St, _Sa>& __fmt, match_flag_type __flags = regex_constants::format_default) const @@ -1865,7 +1874,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ void swap(match_results& __that) - { _Base_type::swap(__that); } + { + using std::swap; + _Base_type::swap(__that); + swap(_M_begin, __that._M_begin); + } //@} private: @@ -2604,7 +2617,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION regex_constants::match_flag_type __m = regex_constants::match_default) : _M_position(__a, __b, __re, __m), - _M_subs(__submatches, *(&__submatches+1)), _M_n(0) + _M_subs(__submatches, __submatches + _Nm), _M_n(0) { _M_init(__a, __b); } /** @@ -2613,12 +2626,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ regex_token_iterator(const regex_token_iterator& __rhs) : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs), - _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_result(__rhs._M_result), - _M_has_m1(__rhs._M_has_m1) - { - if (__rhs._M_result == &__rhs._M_suffix) - _M_result = &_M_suffix; - } + _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1) + { _M_normalize_result(); } /** * @brief Assigns a %regex_token_iterator to another. @@ -2687,9 +2696,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } constexpr bool - _M_end_of_seq() + _M_end_of_seq() const { return _M_result == nullptr; } + // [28.12.2.2.4] + void + _M_normalize_result() + { + if (_M_position != _Position()) + _M_result = &_M_current_match(); + else if (_M_has_m1) + _M_result = &_M_suffix; + else + _M_result = nullptr; + } + _Position _M_position; std::vector<int> _M_subs; value_type _M_suffix; diff --git a/gcc-4.9/libstdc++-v3/include/bits/regex.tcc b/gcc-4.9/libstdc++-v3/include/bits/regex.tcc index 5fa1f01..5eeb0e6 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/regex.tcc +++ b/gcc-4.9/libstdc++-v3/include/bits/regex.tcc @@ -62,6 +62,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return false; typename match_results<_BiIter, _Alloc>::_Base_type& __res = __m; + __m._M_begin = __s; __res.resize(__re._M_automaton->_M_sub_count() + 2); for (auto& __it : __res) __it.matched = false; @@ -274,53 +275,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION "right-curly-bracket", "tilde", "DEL", - "" }; - // same as boost - //static const char* __digraphs[] = - // { - // "ae", - // "Ae", - // "AE", - // "ch", - // "Ch", - // "CH", - // "ll", - // "Ll", - // "LL", - // "ss", - // "Ss", - // "SS", - // "nj", - // "Nj", - // "NJ", - // "dz", - // "Dz", - // "DZ", - // "lj", - // "Lj", - // "LJ", - // "" - // }; - - std::string __s(__last - __first, '?'); - __fctyp.narrow(__first, __last, '?', &*__s.begin()); - - for (unsigned int __i = 0; *__collatenames[__i]; __i++) - if (__s == __collatenames[__i]) - return string_type(1, __fctyp.widen(static_cast<char>(__i))); - - //for (unsigned int __i = 0; *__digraphs[__i]; __i++) - // { - // const char* __now = __digraphs[__i]; - // if (__s == __now) - // { - // string_type ret(__s.size(), __fctyp.widen('?')); - // __fctyp.widen(__now, __now + 2/* ouch */, &*ret.begin()); - // return ret; - // } - // } + string __s(__first, __last); + for (const auto& __it : __collatenames) + if (__s == __it) + return string_type(1, __fctyp.widen( + static_cast<char>(&__it - __collatenames))); + + // TODO Add digraph support: + // http://boost.sourceforge.net/libs/regex/doc/collating_names.html + return string_type(); } @@ -331,12 +296,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase) const { typedef std::ctype<char_type> __ctype_type; - typedef std::ctype<char> __cctype_type; - typedef const pair<const char*, char_class_type> _ClassnameEntry; const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); - const __cctype_type& __cctyp(use_facet<__cctype_type>(_M_locale)); - static _ClassnameEntry __classnames[] = + // Mappings from class name to class mask. + static const pair<const char*, char_class_type> __classnames[] = { {"d", ctype_base::digit}, {"w", {ctype_base::alnum, _RegexMask::_S_under}}, @@ -355,22 +318,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION {"xdigit", ctype_base::xdigit}, }; - std::string __s(__last - __first, '?'); - __fctyp.narrow(__first, __last, '?', &__s[0]); - __cctyp.tolower(&*__s.begin(), &*__s.begin() + __s.size()); - for (_ClassnameEntry* __it = __classnames; - __it < *(&__classnames + 1); - ++__it) - { - if (__s == __it->first) - { - if (__icase - && ((__it->second - & (ctype_base::lower | ctype_base::upper)) != 0)) - return ctype_base::alpha; - return __it->second; - } - } + string __s; + for (auto __cur = __first; __cur != __last; ++__cur) + __s += __fctyp.narrow(__fctyp.tolower(*__cur), '?'); + + for (const auto& __it : __classnames) + if (__s == __it.first) + { + if (__icase + && ((__it.second + & (ctype_base::lower | ctype_base::upper)) != 0)) + return ctype_base::alpha; + return __it.second; + } return 0; } @@ -581,8 +541,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION | regex_constants::match_continuous)) { _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched); - _M_match.at(_M_match.size()).first = __prefix_first; - _M_match._M_in_iterator = true; + auto& __prefix = _M_match.at(_M_match.size()); + __prefix.first = __prefix_first; + __prefix.matched = __prefix.first != __prefix.second; + // [28.12.1.4.5] _M_match._M_begin = _M_begin; return *this; } @@ -594,8 +556,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags)) { _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched); - _M_match.at(_M_match.size()).first = __prefix_first; - _M_match._M_in_iterator = true; + auto& __prefix = _M_match.at(_M_match.size()); + __prefix.first = __prefix_first; + __prefix.matched = __prefix.first != __prefix.second; + // [28.12.1.4.5] _M_match._M_begin = _M_begin; } else @@ -614,11 +578,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_position = __rhs._M_position; _M_subs = __rhs._M_subs; _M_n = __rhs._M_n; - _M_result = __rhs._M_result; _M_suffix = __rhs._M_suffix; _M_has_m1 = __rhs._M_has_m1; - if (__rhs._M_result == &__rhs._M_suffix) - _M_result = &_M_suffix; + _M_normalize_result(); return *this; } diff --git a/gcc-4.9/libstdc++-v3/include/bits/regex_compiler.tcc b/gcc-4.9/libstdc++-v3/include/bits/regex_compiler.tcc index 14e40c0..ffe0170 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/regex_compiler.tcc +++ b/gcc-4.9/libstdc++-v3/include/bits/regex_compiler.tcc @@ -271,7 +271,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { auto& __tmp = _M_nfa[__stack.top()]; __stack.pop(); - swap(__tmp._M_next, __tmp._M_alt); + std::swap(__tmp._M_next, __tmp._M_alt); } } _M_stack.push(__e); diff --git a/gcc-4.9/libstdc++-v3/include/bits/regex_executor.tcc b/gcc-4.9/libstdc++-v3/include/bits/regex_executor.tcc index 052302b..1dc6543 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/regex_executor.tcc +++ b/gcc-4.9/libstdc++-v3/include/bits/regex_executor.tcc @@ -267,9 +267,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_dfs<__match_mode>(__state._M_next); break; case _S_opcode_match: + if (_M_current == _M_end) + break; if (__dfs_mode) { - if (_M_current != _M_end && __state._M_matches(*_M_current)) + if (__state._M_matches(*_M_current)) { ++_M_current; _M_dfs<__match_mode>(__state._M_next); @@ -350,23 +352,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: _M_word_boundary(_State<_TraitsT> __state) const { - // By definition. - bool __ans = false; - auto __pre = _M_current; - --__pre; - if (!(_M_at_begin() && _M_at_end())) + bool __left_is_word = false; + if (_M_current != _M_begin + || (_M_flags & regex_constants::match_prev_avail)) { - if (_M_at_begin()) - __ans = _M_is_word(*_M_current) - && !(_M_flags & regex_constants::match_not_bow); - else if (_M_at_end()) - __ans = _M_is_word(*__pre) - && !(_M_flags & regex_constants::match_not_eow); - else - __ans = _M_is_word(*_M_current) - != _M_is_word(*__pre); + auto __prev = _M_current; + if (_M_is_word(*std::prev(__prev))) + __left_is_word = true; } - return __ans; + bool __right_is_word = + _M_current != _M_end && _M_is_word(*_M_current); + + if (__left_is_word == __right_is_word) + return false; + if (__left_is_word && !(_M_flags & regex_constants::match_not_eow)) + return true; + if (__right_is_word && !(_M_flags & regex_constants::match_not_bow)) + return true; + return false; } _GLIBCXX_END_NAMESPACE_VERSION diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_algo.h b/gcc-4.9/libstdc++-v3/include/bits/stl_algo.h index 104ab86..40233c5 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_algo.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_algo.h @@ -3629,7 +3629,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Efficiently compare identical prefixes: O(N) if sequences // have the same elements in the same order. - for (; __first1 != __last1; ++__first1, ++__first2) + for (; __first1 != __last1 && __first2 != __last2; + ++__first1, ++__first2) if (!__pred(__first1, __first2)) break; @@ -4464,7 +4465,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO if (__first != __last) for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) - std::iter_swap(__i, __first + (std::rand() % ((__i - __first) + 1))); + { + _RandomAccessIterator __j = __first + + std::rand() % ((__i - __first) + 1); + if (__i != __j) + std::iter_swap(__i, __j); + } } /** @@ -4498,7 +4504,11 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO if (__first == __last) return; for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) - std::iter_swap(__i, __first + __rand((__i - __first) + 1)); + { + _RandomAccessIterator __j = __first + __rand((__i - __first) + 1); + if (__i != __j) + std::iter_swap(__i, __j); + } } diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_algobase.h b/gcc-4.9/libstdc++-v3/include/bits/stl_algobase.h index 5ff21be..f7c11e9 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_algobase.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_algobase.h @@ -1091,6 +1091,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO } #if __cplusplus > 201103L + +#define __cpp_lib_robust_nonmodifying_seq_ops 201304 + /** * @brief Tests a range for element-wise equality. * @ingroup non_mutating_algorithms diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_function.h b/gcc-4.9/libstdc++-v3/include/bits/stl_function.h index 8703ce9..71215b8 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_function.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_function.h @@ -217,6 +217,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #if __cplusplus > 201103L + +#define __cpp_lib_transparent_operators 201210 +//#define __cpp_lib_generic_associative_lookup 201304 + template<> struct plus<void> { diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_queue.h b/gcc-4.9/libstdc++-v3/include/bits/stl_queue.h index b516664..32124e3 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_queue.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_queue.h @@ -58,6 +58,9 @@ #include <bits/concept_check.h> #include <debug/debug.h> +#if __cplusplus >= 201103L +# include <bits/uses_allocator.h> +#endif namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_stack.h b/gcc-4.9/libstdc++-v3/include/bits/stl_stack.h index ee187da..f4bb72c 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_stack.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_stack.h @@ -58,6 +58,9 @@ #include <bits/concept_check.h> #include <debug/debug.h> +#if __cplusplus >= 201103L +# include <bits/uses_allocator.h> +#endif namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_uninitialized.h b/gcc-4.9/libstdc++-v3/include/bits/stl_uninitialized.h index cd2a482..42b4026 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_uninitialized.h @@ -115,8 +115,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const bool __assignable = true; #else // trivial types can have deleted assignment - typedef typename iterator_traits<_InputIterator>::reference _RefType; - const bool __assignable = is_assignable<_ValueType1, _RefType>::value; + typedef typename iterator_traits<_InputIterator>::reference _RefType1; + typedef typename iterator_traits<_ForwardIterator>::reference _RefType2; + const bool __assignable = is_assignable<_RefType2, _RefType1>::value; #endif return std::__uninitialized_copy<__is_trivial(_ValueType1) diff --git a/gcc-4.9/libstdc++-v3/include/bits/unique_ptr.h b/gcc-4.9/libstdc++-v3/include/bits/unique_ptr.h index c72fbc7..ce38c5a 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/unique_ptr.h +++ b/gcc-4.9/libstdc++-v3/include/bits/unique_ptr.h @@ -743,6 +743,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #if __cplusplus > 201103L + +#define __cpp_lib_make_unique 201304 + template<typename _Tp> struct _MakeUniq { typedef unique_ptr<_Tp> __single_object; }; diff --git a/gcc-4.9/libstdc++-v3/include/bits/vector.tcc b/gcc-4.9/libstdc++-v3/include/bits/vector.tcc index 015ccd6..9bdc659 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/vector.tcc +++ b/gcc-4.9/libstdc++-v3/include/bits/vector.tcc @@ -252,7 +252,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { __sanitizer_vector_annotate_delete(); vector __tmp(__n, __val, _M_get_Tp_allocator()); - __tmp.swap(*this); + __tmp._M_impl._M_swap_data(this->_M_impl); } else if (__n > size()) { |