Quote Originally Posted by whiteflags View Post
So let's say I have obj foo which is your array class. I also have bar, which is an element that I want to shift in by n places. I don't think you should use a shift operator here because it's a bit awkward.

I mean this is going to be common right?

foo >> n; // make a hole
foo[n] = bar;

Why not just make that a member function instead? It's obvious what shiftIntoPlace(bar, n); does. And you cannot possibly forget to assign something in the hole. Sorry if that is strange advice, but this is how I would write it; mainly so that I can guarantee that there is only empty space at the end of the array. Your way is a kludge to me.
You would shift everything by n spaces, you wouldn't create any holes. You decide if the elements that go out-of-bounds are cycled (go in front) or lost. If you had an array of strings lets say "boy" "loves "girl". Cycling you would have "girl" "boy" "loves". By losing elements you have "" "boy" "loves". Asumming left shifting of course.

Shifting could do something similar with bitwise operators. Since this is an array you can have it not "lose" elements, but allocate one more space to save the element that would go out of bounds.

It could be useful. Not very efficient probably, since it would be easier "shifting" the indexes rather than the elements themselves if the object is bigger than an int.