File indexing completed on 2025-01-18 09:43:32
0001
0002
0003
0004
0005
0006 #ifndef BOOST_QUEUE_HPP
0007 #define BOOST_QUEUE_HPP
0008
0009 #include <deque>
0010 #include <algorithm>
0011
0012 namespace boost
0013 {
0014
0015 template < class _Tp, class _Sequence = std::deque< _Tp > > class queue;
0016
0017 template < class _Tp, class _Seq >
0018 inline bool operator==(const queue< _Tp, _Seq >&, const queue< _Tp, _Seq >&);
0019
0020 template < class _Tp, class _Seq >
0021 inline bool operator<(const queue< _Tp, _Seq >&, const queue< _Tp, _Seq >&);
0022
0023 template < class _Tp, class _Sequence > class queue
0024 {
0025
0026 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
0027 template < class _Tp1, class _Seq1 >
0028 friend bool operator==(
0029 const queue< _Tp1, _Seq1 >&, const queue< _Tp1, _Seq1 >&);
0030 template < class _Tp1, class _Seq1 >
0031 friend bool operator<(
0032 const queue< _Tp1, _Seq1 >&, const queue< _Tp1, _Seq1 >&);
0033 #endif
0034 public:
0035 typedef typename _Sequence::value_type value_type;
0036 typedef typename _Sequence::size_type size_type;
0037 typedef _Sequence container_type;
0038
0039 typedef typename _Sequence::reference reference;
0040 typedef typename _Sequence::const_reference const_reference;
0041 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
0042 protected:
0043 #endif
0044 _Sequence c;
0045
0046 public:
0047 queue() : c() {}
0048 explicit queue(const _Sequence& __c) : c(__c) {}
0049
0050 bool empty() const { return c.empty(); }
0051 size_type size() const { return c.size(); }
0052 reference front() { return c.front(); }
0053 const_reference front() const { return c.front(); }
0054 reference top() { return c.front(); }
0055 const_reference top() const { return c.front(); }
0056 reference back() { return c.back(); }
0057 const_reference back() const { return c.back(); }
0058 void push(const value_type& __x) { c.push_back(__x); }
0059 void pop() { c.pop_front(); }
0060
0061 void swap(queue& other)
0062 {
0063 using std::swap;
0064 swap(c, other.c);
0065 }
0066 };
0067
0068 template < class _Tp, class _Sequence >
0069 bool operator==(
0070 const queue< _Tp, _Sequence >& __x, const queue< _Tp, _Sequence >& __y)
0071 {
0072 return __x.c == __y.c;
0073 }
0074
0075 template < class _Tp, class _Sequence >
0076 bool operator<(
0077 const queue< _Tp, _Sequence >& __x, const queue< _Tp, _Sequence >& __y)
0078 {
0079 return __x.c < __y.c;
0080 }
0081
0082 template < class _Tp, class _Sequence >
0083 bool operator!=(
0084 const queue< _Tp, _Sequence >& __x, const queue< _Tp, _Sequence >& __y)
0085 {
0086 return !(__x == __y);
0087 }
0088
0089 template < class _Tp, class _Sequence >
0090 bool operator>(
0091 const queue< _Tp, _Sequence >& __x, const queue< _Tp, _Sequence >& __y)
0092 {
0093 return __y < __x;
0094 }
0095
0096 template < class _Tp, class _Sequence >
0097 bool operator<=(
0098 const queue< _Tp, _Sequence >& __x, const queue< _Tp, _Sequence >& __y)
0099 {
0100 return !(__y < __x);
0101 }
0102
0103 template < class _Tp, class _Sequence >
0104 bool operator>=(
0105 const queue< _Tp, _Sequence >& __x, const queue< _Tp, _Sequence >& __y)
0106 {
0107 return !(__x < __y);
0108 }
0109
0110 template < class _Tp, class _Sequence >
0111 inline void swap(queue< _Tp, _Sequence >& __x, queue< _Tp, _Sequence >& __y)
0112 {
0113 __x.swap(__y);
0114 }
0115
0116 }
0117
0118 #endif