// Multiset implementation -*- C++ -*-
-// Copyright (C) 2001-2013 Free Software Foundation, Inc.
+// Copyright (C) 2001-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
}
#if __cplusplus >= 201103L
- /**
- * @brief %Multiset move assignment operator.
- * @param __x A %multiset of identical element and allocator types.
- *
- * The contents of @a __x are moved into this %multiset
- * (without copying). @a __x is a valid, but unspecified
- * %multiset.
- */
+ /// Move assignment operator.
multiset&
- operator=(multiset&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
- {
- if (!_M_t._M_move_assign(__x._M_t))
- {
- // The rvalue's allocator cannot be moved and is not equal,
- // so we need to individually move each element.
- clear();
- insert(std::__make_move_if_noexcept_iterator(__x._M_t.begin()),
- std::__make_move_if_noexcept_iterator(__x._M_t.end()));
- __x.clear();
- }
- return *this;
- }
+ operator=(multiset&&) = default;
/**
* @brief %Multiset list assignment operator.
multiset&
operator=(initializer_list<value_type> __l)
{
- this->clear();
- this->insert(__l.begin(), __l.end());
+ _M_t._M_assign_equal(__l.begin(), __l.end());
return *this;
}
#endif
* improve the performance of the insertion process. A bad hint would
* cause no gains in efficiency.
*
- * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
+ * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints
* for more on @a hinting.
*
* Insertion requires logarithmic time (if the hint is not taken).
* improve the performance of the insertion process. A bad hint would
* cause no gains in efficiency.
*
- * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
+ * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints
* for more on @a hinting.
*
* Insertion requires logarithmic time (if the hint is not taken).
// multiset operations:
+ //@{
/**
* @brief Finds the number of elements with given key.
* @param __x Key of elements to be located.
count(const key_type& __x) const
{ return _M_t.count(__x); }
+#if __cplusplus > 201103L
+ template<typename _Kt>
+ auto
+ count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x))
+ { return _M_t._M_count_tr(__x); }
+#endif
+ //@}
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload
//@{
const_iterator
find(const key_type& __x) const
{ return _M_t.find(__x); }
+
+#if __cplusplus > 201103L
+ template<typename _Kt>
+ auto
+ find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x))
+ { return _M_t._M_find_tr(__x); }
+
+ template<typename _Kt>
+ auto
+ find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x))
+ { return _M_t._M_find_tr(__x); }
+#endif
//@}
//@{
const_iterator
lower_bound(const key_type& __x) const
{ return _M_t.lower_bound(__x); }
+
+#if __cplusplus > 201103L
+ template<typename _Kt>
+ auto
+ lower_bound(const _Kt& __x)
+ -> decltype(_M_t._M_lower_bound_tr(__x))
+ { return _M_t._M_lower_bound_tr(__x); }
+
+ template<typename _Kt>
+ auto
+ lower_bound(const _Kt& __x) const
+ -> decltype(_M_t._M_lower_bound_tr(__x))
+ { return _M_t._M_lower_bound_tr(__x); }
+#endif
//@}
//@{
const_iterator
upper_bound(const key_type& __x) const
{ return _M_t.upper_bound(__x); }
+
+#if __cplusplus > 201103L
+ template<typename _Kt>
+ auto
+ upper_bound(const _Kt& __x)
+ -> decltype(_M_t._M_upper_bound_tr(__x))
+ { return _M_t._M_upper_bound_tr(__x); }
+
+ template<typename _Kt>
+ auto
+ upper_bound(const _Kt& __x) const
+ -> decltype(_M_t._M_upper_bound_tr(__x))
+ { return _M_t._M_upper_bound_tr(__x); }
+#endif
//@}
//@{
std::pair<const_iterator, const_iterator>
equal_range(const key_type& __x) const
{ return _M_t.equal_range(__x); }
+
+#if __cplusplus > 201103L
+ template<typename _Kt>
+ auto
+ equal_range(const _Kt& __x)
+ -> decltype(_M_t._M_equal_range_tr(__x))
+ { return _M_t._M_equal_range_tr(__x); }
+
+ template<typename _Kt>
+ auto
+ equal_range(const _Kt& __x) const
+ -> decltype(_M_t._M_equal_range_tr(__x))
+ { return _M_t._M_equal_range_tr(__x); }
+#endif
//@}
template<typename _K1, typename _C1, typename _A1>