示例#1
0
        public void PeekTest()
        {
            var q = UnsafeRingBuffer.Allocate <int>(10);

            for (int i = 0; i < 10; i++)
            {
                UnsafeRingBuffer.Push(q, (int)Math.Pow(i + 2, 2));
            }

            for (int i = 0; i < 10; i++)
            {
                UnsafeRingBuffer.Peek <int>(q, out int num);
                Assert.AreEqual(4, num);
            }

            //Verify no items are dequeued
            Assert.AreEqual(10, UnsafeRingBuffer.GetCount(q));

            UnsafeRingBuffer.Free(q);
        }
 public bool Peek(out T value)
 {
     return(UnsafeRingBuffer.Peek(m_inner, out value));
 }