I need some help with the logic of a function I have. I simply am trying to return an element of a list...
1) am I returning the element correctly via the iterator?Code:std::list < Font > m_fontList; Font &Graphics::GetFont( const std::string &fontName ) { std::list< Font >::iterator listIterator; // Find the font. for( listIterator = m_fontList.begin(); listIterator != m_fontList.end(); listIterator++ ) { if( listIterator->GetFontName() == fontName ) { return *listIterator; //1 is this correct } } // 2 What would the default return value be if the element was not found }
2) What would I do for the default return value?
Regards
Chad