acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
queue.h
1
#pragma once
2
3
// from cplusplus.com
4
// FIFO queue
5
// queues are a type of container adaptor, specifically designed to operate in a
6
// FIFO action_context (first-in first-out), where elements are inserted into one end of
7
// the container and extracted from the other.
8
//
9
// queues are implemented as containers adaptors, which are classes that use an
10
// encapsulated matter of a specific container class as its underlying container,
12
// are pushed into the "back" of the specific container and popped from its "front".
13
14
// The underlying container may be one of the standard container class template or
15
// some other specifically designed container class. The only requirement is that
16
// it supports the following operations:
17
18
// front()
19
// back()
20
// add()
21
// pop_front()
22
23
24
25
26
template
<
class
TYPE,
class
CONTAINER = deque < TYPE > >
27
class
queue
:
28
public
CONTAINER
29
{
30
public
:
31
32
inline
bool
is_empty()
const
;
33
inline ::collection::count size()
const
;
34
35
inline
TYPE & front();
36
inline
const
TYPE & front()
const
;
37
38
inline
TYPE & back();
39
inline
const
TYPE & back()
const
;
40
41
inline
void
push(
const
TYPE & t);
42
43
inline
void
pop();
44
45
};
46
47
48
template
<
class
TYPE,
class
CONTAINER >
49
inline
bool
queue < TYPE, CONTAINER > ::is_empty()
const
50
{
51
52
return
this->CONTAINER::is_empty();
53
54
}
55
56
template
<
class
TYPE,
class
CONTAINER >
57
inline ::collection::count queue < TYPE, CONTAINER > ::size()
const
58
{
59
60
return
this->CONTAINER::size();
61
62
}
63
64
65
template
<
class
TYPE,
class
CONTAINER >
66
inline
TYPE & queue < TYPE, CONTAINER > ::front()
67
{
68
69
return
this->CONTAINER::front();
70
71
}
72
73
template
<
class
TYPE,
class
CONTAINER >
74
inline
const
TYPE & queue < TYPE, CONTAINER > ::front()
const
75
{
76
77
return
this->CONTAINER::front();
78
79
}
80
81
template
<
class
TYPE,
class
CONTAINER >
82
inline
TYPE & queue < TYPE, CONTAINER > ::back()
83
{
84
85
return
this->CONTAINER::back();
86
87
}
88
89
template
<
class
TYPE,
class
CONTAINER >
90
inline
const
TYPE & queue < TYPE, CONTAINER > ::back()
const
91
{
92
93
return
this->CONTAINER::back();
94
95
}
96
97
template
<
class
TYPE,
class
CONTAINER >
98
inline
void
queue < TYPE, CONTAINER > ::push(
const
TYPE & t)
99
{
100
101
this->CONTAINER::add(t);
102
103
}
104
105
template
<
class
TYPE,
class
CONTAINER >
106
inline
void
queue < TYPE, CONTAINER > ::pop()
107
{
108
109
this->CONTAINER::pop_front();
110
111
}
112
113
queue
providing a specific set of member functions to access its elements. Elements
Definition
queue.h:29
prototype
collection
queue.h
Generated by
1.17.0