1 // =================================
 2 // Copyright (c) 2024 Seppo Laakko
 3 // Distributed under the MIT license
 4 // =================================
 5 
 6 using System;
 7 using System.Concepts;
 8 
 9 namespace System.Collections
10 {
11     public class Queue<T> where T is Semiregular
12     {
13         public typedef T ValueType;
14 
15         public inline bool IsEmpty() const
16         {
17             return items.IsEmpty();
18         }
19         public inline long Count() const
20         {
21             return items.Count();
22         }
23         public inline void Put(const ValueType& item)
24         {
25             items.Add(item);
26         }
27         public inline void Put(ValueType&& item)
28         {
29             items.Add(item);
30         }
31         public inline ValueType Get()
32         {
33             ValueType first = Front();
34             items.RemoveFirst();
35             return first;
36         }
37         public inline const ValueType& Front() const
38         {
39             return items.Front();
40         }
41         public inline void Clear()
42         {
43             items.Clear();
44         }
45         public inline LinkedList<ValueType>& Rep()
46         {
47             return items;
48         }
49         private LinkedList<ValueType> items;
50     }