Labels: c++ (6) scripting (4) the perfect project (3) coding (1) firefox (1) idea (1)

Sunday, February 4, 2007

Printing map keys

Note select1st is not a part of Standard C++ Library but STL. Particularly it's supported by STLPort. typedef std::map< std::string, std::string > Parameters;
Parameters parameters;
...
std::ostringstream os;
os << "Wrong parameters: ";
std::transform( parameters.begin(), parameters.end(),
                std::ostream_iterator<std::string>( os, " " ),
                std::select1st< Parameters::value_type >() );
throw Exception( os.str() );

No comments: