* called (*_unique versus *_equal, same as the standard).
* @endif
*/
- template <class _Key, class _Compare = std::less<_Key>,
- class _Alloc = std::allocator<_Key> >
+ template <typename _Key, typename _Compare = std::less<_Key>,
+ typename _Alloc = std::allocator<_Key> >
class multiset
{
// concept requirements
typedef typename _Rep_type::difference_type difference_type;
// allocation/deallocation
-
/**
* @brief Default constructor creates no elements.
*/
multiset()
- : _M_t(_Compare(), allocator_type()) { }
+ : _M_t() { }
+ /**
+ * @brief Creates a %multiset with no elements.
+ * @param comp Comparator to use.
+ * @param a An allocator object.
+ */
explicit
multiset(const _Compare& __comp,
const allocator_type& __a = allocator_type())
* [first,last). This is linear in N if the range is already sorted,
* and NlogN otherwise (where N is distance(first,last)).
*/
- template <class _InputIterator>
+ template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
+ : _M_t()
{ _M_t._M_insert_equal(__first, __last); }
/**
* [first,last). This is linear in N if the range is already sorted,
* and NlogN otherwise (where N is distance(first,last)).
*/
- template <class _InputIterator>
+ template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const allocator_type& __a = allocator_type())
* The newly-created %multiset uses a copy of the allocation object used
* by @a x.
*/
- multiset(const multiset<_Key,_Compare,_Alloc>& __x)
+ multiset(const multiset& __x)
: _M_t(__x._M_t) { }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Multiset move constructor.
+ * @param x A %multiset of identical element and allocator types.
+ *
+ * The newly-created %multiset contains the exact contents of @a x.
+ * The contents of @a x are a valid, but unspecified %multiset.
+ */
+ multiset(multiset&& __x)
+ : _M_t(__x._M_t.key_comp(),
+ __x._M_t._M_get_Node_allocator())
+ { this->swap(__x); }
+#endif
+
/**
* @brief %Multiset assignment operator.
* @param x A %multiset of identical element and allocator types.
* All the elements of @a x are copied, but unlike the copy constructor,
* the allocator object is not copied.
*/
- multiset<_Key,_Compare,_Alloc>&
- operator=(const multiset<_Key,_Compare,_Alloc>& __x)
+ multiset&
+ operator=(const multiset& __x)
{
_M_t = __x._M_t;
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @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.
+ */
+ multiset&
+ operator=(multiset&& __x)
+ {
+ this->swap(__x);
+ return *this;
+ }
+#endif
+
// accessors:
/// Returns the comparison object.
* std::swap(s1,s2) will feed to this function.
*/
void
- swap(multiset<_Key, _Compare, _Alloc>& __x)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(multiset&& __x)
+#else
+ swap(multiset& __x)
+#endif
{ _M_t.swap(__x._M_t); }
// insert/erase
*
* Complexity similar to that of the range constructor.
*/
- template <class _InputIterator>
+ template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
{ _M_t._M_insert_equal(__first, __last); }
equal_range(const key_type& __x) const
{ return _M_t.equal_range(__x); }
- template <class _K1, class _C1, class _A1>
+ template<typename _K1, typename _C1, typename _A1>
friend bool
- operator== (const multiset<_K1, _C1, _A1>&,
- const multiset<_K1, _C1, _A1>&);
+ operator==(const multiset<_K1, _C1, _A1>&,
+ const multiset<_K1, _C1, _A1>&);
- template <class _K1, class _C1, class _A1>
+ template<typename _K1, typename _C1, typename _A1>
friend bool
operator< (const multiset<_K1, _C1, _A1>&,
const multiset<_K1, _C1, _A1>&);
* Multisets are considered equivalent if their sizes are equal, and if
* corresponding elements compare equal.
*/
- template <class _Key, class _Compare, class _Alloc>
+ template<typename _Key, typename _Compare, typename _Alloc>
inline bool
operator==(const multiset<_Key, _Compare, _Alloc>& __x,
const multiset<_Key, _Compare, _Alloc>& __y)
*
* See std::lexicographical_compare() for how the determination is made.
*/
- template <class _Key, class _Compare, class _Alloc>
+ template<typename _Key, typename _Compare, typename _Alloc>
inline bool
operator<(const multiset<_Key, _Compare, _Alloc>& __x,
const multiset<_Key, _Compare, _Alloc>& __y)
{ return __x._M_t < __y._M_t; }
/// Returns !(x == y).
- template <class _Key, class _Compare, class _Alloc>
+ template<typename _Key, typename _Compare, typename _Alloc>
inline bool
operator!=(const multiset<_Key, _Compare, _Alloc>& __x,
const multiset<_Key, _Compare, _Alloc>& __y)
{ return !(__x == __y); }
/// Returns y < x.
- template <class _Key, class _Compare, class _Alloc>
+ template<typename _Key, typename _Compare, typename _Alloc>
inline bool
operator>(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y)
{ return __y < __x; }
/// Returns !(y < x)
- template <class _Key, class _Compare, class _Alloc>
+ template<typename _Key, typename _Compare, typename _Alloc>
inline bool
operator<=(const multiset<_Key, _Compare, _Alloc>& __x,
const multiset<_Key, _Compare, _Alloc>& __y)
{ return !(__y < __x); }
/// Returns !(x < y)
- template <class _Key, class _Compare, class _Alloc>
+ template<typename _Key, typename _Compare, typename _Alloc>
inline bool
operator>=(const multiset<_Key, _Compare, _Alloc>& __x,
const multiset<_Key, _Compare, _Alloc>& __y)
{ return !(__x < __y); }
/// See std::multiset::swap().
- template <class _Key, class _Compare, class _Alloc>
+ template<typename _Key, typename _Compare, typename _Alloc>
inline void
swap(multiset<_Key, _Compare, _Alloc>& __x,
multiset<_Key, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline void
+ swap(multiset<_Key, _Compare, _Alloc>&& __x,
+ multiset<_Key, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline void
+ swap(multiset<_Key, _Compare, _Alloc>& __x,
+ multiset<_Key, _Compare, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_MULTISET_H */