Click here to Skip to main content
15,896,912 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Winner Does not Stay on - The Unofficial CCC Pin
musefan6-Feb-20 1:20
musefan6-Feb-20 1:20 
GeneralRe: Winner Does not Stay on - The Unofficial CCC Pin
Abbas A. Ali6-Feb-20 1:55
professionalAbbas A. Ali6-Feb-20 1:55 
GeneralRe: Winner Does not Stay on - The Unofficial CCC Pin
Paddington Bear6-Feb-20 1:54
Paddington Bear6-Feb-20 1:54 
GeneralRe: Winner Does not Stay on - The Unofficial CCC Pin
Abbas A. Ali6-Feb-20 1:55
professionalAbbas A. Ali6-Feb-20 1:55 
GeneralRe: Winner Does not Stay on - The Unofficial CCC Pin
musefan6-Feb-20 2:15
musefan6-Feb-20 2:15 
GeneralRe: Winner Does not Stay on - The Unofficial CCC Pin
Paddington Bear6-Feb-20 2:19
Paddington Bear6-Feb-20 2:19 
GeneralRe: Winner Does not Stay on - The Unofficial CCC Pin
Abbas A. Ali6-Feb-20 2:26
professionalAbbas A. Ali6-Feb-20 2:26 
QuestionNeed an opinion on a circular IList<T> implementation Pin
honey the codewitch5-Feb-20 22:47
mvahoney the codewitch5-Feb-20 22:47 
I've implemented a list with circular buffer semantics meaning adding or removing from either end of the list is very efficient.

Because of this, the list can be efficiently used as a queue, a double ended queue, or a stack.

Well, right now I don't have any special methods to reflect the more efficient add and remove ops.

Doing an efficient add just means list.Add(item) for the end or list.Insert(0,item) for the beginning. Doing an efficient remove is similar with either list.RemoveAt(0) or list.RemoveAt(list.Count-1).

My question is this - should I add special methods for these efficient ops and if so what should they be?

I can go the .NET route that MS took and add methods like Enqueue() and Dequeue() (queue-like) but that only covers adding to the back, and removing from the front. I can add Pop() and Push() (stack-like) but that only covers adding and removing from the back. I can add both but that's cluttered and sill doesn't handle removing from the front.

Or I can take a page from C++/STL and add methods like PushFront() and PushBack() and similar remove methods, even though there's nothing in .NET like this.

Or I can just not add those extra methods and I can document the existing methods with the specially performing cases.

What would you do? Any ideas?
Real programmers use butterflies

AnswerRe: Need an opinion on a circular IList<T> implementation Pin
phil.o5-Feb-20 22:56
professionalphil.o5-Feb-20 22:56 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
honey the codewitch5-Feb-20 23:04
mvahoney the codewitch5-Feb-20 23:04 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
phil.o5-Feb-20 23:24
professionalphil.o5-Feb-20 23:24 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
Jörgen Andersson5-Feb-20 23:34
professionalJörgen Andersson5-Feb-20 23:34 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
honey the codewitch5-Feb-20 23:44
mvahoney the codewitch5-Feb-20 23:44 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
Jörgen Andersson6-Feb-20 0:40
professionalJörgen Andersson6-Feb-20 0:40 
AnswerRe: Need an opinion on a circular IList<T> implementation Pin
harold aptroot5-Feb-20 23:03
harold aptroot5-Feb-20 23:03 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
honey the codewitch5-Feb-20 23:05
mvahoney the codewitch5-Feb-20 23:05 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
OriginalGriff5-Feb-20 23:19
mveOriginalGriff5-Feb-20 23:19 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
honey the codewitch5-Feb-20 23:39
mvahoney the codewitch5-Feb-20 23:39 
AnswerRe: Need an opinion on a circular IList<T> implementation Pin
Sander Rossel5-Feb-20 23:27
professionalSander Rossel5-Feb-20 23:27 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
honey the codewitch5-Feb-20 23:37
mvahoney the codewitch5-Feb-20 23:37 
AnswerRe: Need an opinion on a circular IList<T> implementation Pin
Arthur V. Ratz5-Feb-20 23:31
professionalArthur V. Ratz5-Feb-20 23:31 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
honey the codewitch5-Feb-20 23:42
mvahoney the codewitch5-Feb-20 23:42 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
Arthur V. Ratz5-Feb-20 23:51
professionalArthur V. Ratz5-Feb-20 23:51 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
honey the codewitch5-Feb-20 23:56
mvahoney the codewitch5-Feb-20 23:56 
GeneralRe: Need an opinion on a circular IList<T> implementation Pin
Arthur V. Ratz5-Feb-20 23:59
professionalArthur V. Ratz5-Feb-20 23:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.