Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

not returning temporary objects, even inside the object itself

  • Loading branch information...
commit 1840272741916cea443c6bf05a3908d61e790681 1 parent e1616cd
@morgner authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 system/include/environment.h
View
7 system/include/environment.h
@@ -152,15 +152,16 @@ class CEnvironment : public std::map<std::string, std::string>
operator option* () { return &this->front(); }
operator option& () { return this->front(); }
- const std::string& ShortOptionsGet() { return m_sShortOpt; }
+ const std::string ShortOptionsGet() { return m_sShortOpt; }
bool hasShortOption( const int c )
{
return ShortOptionsGet().find( (char)c ) != std::string::npos;
}
- const std::string& LongOptionByShortOption( const int c )
+ std::string LongOptionByShortOption( const int c )
{
+ const static std::string sUnknown = "unknown";
for ( iterator it=begin(); it != end(); ++it )
{
if ( it->val == c )
@@ -168,7 +169,7 @@ class CEnvironment : public std::map<std::string, std::string>
return it->name;
}
}
- return "unknown";
+ return sUnknown;
}
void UsagePrint()
Please sign in to comment.
Something went wrong with that request. Please try again.