Fix run_compile_commands build on Apple GCC 3.3

This compiler does not provide the "at" method of std::map.  Approximate
it well enough for our needs.
This commit is contained in:
Brad King 2011-05-16 12:05:49 -04:00
parent c9174c0e4b
commit a7e7a04aaf
1 changed files with 13 additions and 1 deletions

View File

@ -2,7 +2,19 @@
class CompileCommandParser { class CompileCommandParser {
public: public:
typedef std::map<std::string, std::string> CommandType; class CommandType: public std::map<cmStdString, cmStdString>
{
public:
#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ < 4
cmStdString const& at(cmStdString const& k) const
{
const_iterator i = this->find(k);
if(i != this->end()) { return i->second; }
static cmStdString empty;
return empty;
}
#endif
};
typedef std::vector<CommandType> TranslationUnitsType; typedef std::vector<CommandType> TranslationUnitsType;
CompileCommandParser(std::ifstream *input) CompileCommandParser(std::ifstream *input)