Listing 4

#include<example_2_stlglob.h>
// ...
class ShowItem : public std::unary_function< const std::string& , void > {
    // ... functor that shows (prints) item names ...
} ;
int main( const int argc , const char** argv ){
    // ... 
    STLGlob dir( argv[1] ) ;
    for( int ix = 2 ; ix < argc ; ++ix ){
        try{
            dir.push_back( argv[ix] ) ;
        }catch( std::runtime_error& e ){
            std::cerr << e.what() << std::endl ;
        }
    }
    std::for_each( dir.begin() , dir.end() , 
                                         ShowItem( "item" , std::cout ) ) ;
    // ...
}