An
std::list
could pop'n'push at its both sides :) :
typedef std::list<int> listYours;
typedef std::auto_ptr<listYours> ptrYours;
void ProduceShiftedListByValue(const ptrYours& listExist, ptrYours& listNew, int iValue)
{
listNew.reset(listExist.get() ?
new listYours(*listExist.get()) : NULL);
if (listNew.get()) {
if (listNew->size()) {
listNew->pop_front();
}
listNew->push_back(iValue);
}
}
typedef std::list<ptrYours> 2dYours;