Awesome! Just what I needed. Why couldn't 10 pages of Bing results find that for me? Leave it to a stuffed dog (?) to have the answer. ;-)

#include <memory>
#include <deque>

void MyFunc
{
    std::deque< std::shared_ptr< Sprite* > > SpriteList;

    func_to_fill_deque( SpriteList );

    for( auto i = SpriteList.begin(), end = SpriteList.end(); i != end; i++ )
    {
        SpriteList[ i ]->spriteFunc();  // doesn't work
        SpriteList.at( i )->spriteFunc(); // also doesn't work
    }
}

void func_to_fill_deque( std::deque< std::shared_ptr< Sprite* > >& list )
{
    ptr = new Sprite( filename );
    list.push_back( std::make_shared< Sprite* >( ptr ) );
}

When I try SpriteList[ i ] I get a red squiggle under the first '[' with the msg "No operator matches these operands" Trying SpriteList.at( i ) gives a red squiggle under the '.' with the msg "No overloaded function matches the argument list" This is in VS2013 if it matters. Any help would be appreciated.

6a619621f3a052655aade91b9b250670

Here you see the player has jumped under the "?" tile which triggered the tile above to display an animation showing the mushroom rising. At the end of the animation, that tile reverts to a blue tile and I want a Mushroom object to Spawn at that location. Thus, I want to call Spawn from Tile->Draw.

Hi, all. I'm have a class EnemyController with a function Spawn(...) that instantiates a new object of the appropriate type. I want to call Spawn from somewhere like my TileMap class to create a new Enemy in my tile collision method. Here's what I have so far...

class EnemyController
{
public:
    EnemyController() {}
    ~EnemyController() {}
    static void Spawn( int x, int y, EnemyType type );
    virtual void OnUpdate( Camera& cam )
    {
        int index = 0;
        for( auto i= EnemyList.begin(), end = EnemyList.end(); i != end; i++ )
        {
            EnemyList.at( index )->GetState().OnUpdate();  
            EnemyList.at( index++ )->Draw( cam );
        }
    }
public:
    static std::deque< EnemySprite* > EnemyList;
};

// Spawn(...) defined in the .cpp file

class TileMap
{
public:
    TileMap( const char* map, int mapWidth, int mapHeight, int tileWidth, int tileHeight );
    ~TileMap();
    void DoCollision( Sprite& s );
//stuff
private:
//stuff
    static EnemyController* eCon;
};

// In DoCollision(...)

if( condition )
{
    TileMap::eCon->Spawn( enemytype );
}

I keep getting "Unresolved External" link errors. I think I'm confused about static? I want the EnemyController class to spawn, keep track of, and manage all enemies, but I want to Spawn from differnt trigger points (hitting a certain tile, etc.).

Got it! Seems I was constipated in the brain. Now, as for all those funcs in the base class for dealing with the private data, am nI on the right track there? If so, I guess I'm on my way with it.

Thanks, AD. So I don't need 'const' on funcs that set a value because something changes, right? As I've been learning, I've been encouraged to make things const if possible. Like 'const void Draw()' - I've used that before without a hitch.

Well, it looks like I'm not quite getting it. Have a look, please...

class GridCell      // One cell of a 9x9 grid
{
public:
    GridCell();
    GridCell( int x, int y, int spriteNum ) // x, y = actual screen location
        :                                   // spriteNum (1-27) Match3 3x27=81 cells
    posX( x ),
    posY( y ),
    spriteNum( spriteNum ),
    Matched( false ),       
    Covered( true ),
    Selected( false ),
    Flipping( false )
    {}
    ~GridCell();
    const void SetMatched( bool mchd ) { Matched = mchd; }
    const void SetCovered( bool cvrd ) { Covered = cvrd; }
    const void SetSelected( bool slctd ) { Selected = slctd; }
    const void SetFlipping( bool flpng ) { Flipping = flpng; }
    const bool IsMatched() { return Matched; }
    const bool IsCovered() { return Covered; }
    const bool IsSelected() { return Selected; }
    const bool IsFlipping() { return Flipping; }

private:
    int posX;
    int posY;
    int spriteNum;
    bool Matched;
    bool Covered;
    bool Selected;
    bool Flipping;

};

class TileGrid : public GridCell    // This should be 81 gridcells
{
public:
    TileGrid();
    ~TileGrid()
    {
        for( int i = 0; i < BOARDSIZE; i++ )
        {
            delete Board[ i ];
        }
        delete [] Board;
    }
    GridCell GetCell( int num ) { return *Board[ num ]; }   // trying to get access
    const void Initialize();
    const void Reset();
    const void ResetMatches();
    const void SetMatch( int num );
    const void CheckMatches();
    const void Draw( D3DGraphics& gfx );
private:
    GridCell** Board;
    int posX;
    int posY;
    struct Match
    {
        int grdnm;
        int sprnm;
    } match[2]; ...

Thanks, vmanes. Sounds like I'll be making the board a class ( for the init and draw funcs ) and leave the struct for matching, just declare a struct object as a class member. Next up, re-writing again as a FSM. One thing at a time, though.

I wrote a game using an array of structs to represent a 9x9 grid. Now I'm re-writing it as a class to '++ it up' a bit and to better understand classes. Part of the game used a seperate struct to keep track of selected board squares (to see if they match). Would it be proper ettiquete to include a struct as a class member, or is there a more 'proper' way?

If you want something to happen when you press with the code you have (getch() and switch()) you need "case 10:" getch() returns an ASCII character code (search the web for the whole list). (or "carriage return") is 10.

Oops, the size will change, won't it. So then...

int sz = Q2.size();
for(int index = 0; index < sz; index+ )
    Q1.push( Q2.pop() );
return Q1;

Try this...

queue<float> append( queue<float> Q1, queue<float> Q2 )
{
    for( int index = 0; index < Q2.size(); index++ )
    {
        Q1.push( Q2.pop() );
    }
    return Q1;
}