J
Jeff
Hello,
I'm finishing a speech recognition jukebox
(http://intelligentjukebox.com/) I have a very basic template
question. I can't find any good examples of what I want to do. I
could write my own sort function faster than I could find a good
reference with examples on the c++ template library.
Can someone tell me how to define the "<" operator so I can use the
sort function for the list template. I want to sort Song objects in
a-z (descending) order by m_filename.
thanks
Here is my code:
//------------------------------------------------------------------------------
class Song
{
public:
Album* m_pAlbum; // make it easy to get the album
string m_name; //display name
string m_filename;
};
list<Song*> *pSongsList; // holds all the songs for this album
//------------------------------------------------------------------------------
I want to this function call to work:
pSongsList->sort();
I'm finishing a speech recognition jukebox
(http://intelligentjukebox.com/) I have a very basic template
question. I can't find any good examples of what I want to do. I
could write my own sort function faster than I could find a good
reference with examples on the c++ template library.
Can someone tell me how to define the "<" operator so I can use the
sort function for the list template. I want to sort Song objects in
a-z (descending) order by m_filename.
thanks
Here is my code:
//------------------------------------------------------------------------------
class Song
{
public:
Album* m_pAlbum; // make it easy to get the album
string m_name; //display name
string m_filename;
};
list<Song*> *pSongsList; // holds all the songs for this album
//------------------------------------------------------------------------------
I want to this function call to work:
pSongsList->sort();