comparison Core/EnumerationDictionary.h @ 2722:a191bbd55a2b jobs

fix for older versions of boost
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Jul 2018 14:32:03 +0200
parents 2c684841da15
children 146eaed9b02c
comparison
equal deleted inserted replaced
2721:062776ab4a21 2722:a191bbd55a2b
82 stringToEnumeration_[boost::lexical_cast<std::string>(static_cast<int>(value))] = value; 82 stringToEnumeration_[boost::lexical_cast<std::string>(static_cast<int>(value))] = value;
83 } 83 }
84 84
85 Enumeration Translate(const std::string& str) const 85 Enumeration Translate(const std::string& str) const
86 { 86 {
87 int value; 87 try
88 if (boost::conversion::try_lexical_convert<int>(str, value))
89 { 88 {
90 return static_cast<Enumeration>(value); 89 return static_cast<Enumeration>(boost::lexical_cast<int>(str));
90 }
91 catch (boost::bad_lexical_cast&)
92 {
91 } 93 }
92 94
93 typename StringToEnumeration::const_iterator 95 typename StringToEnumeration::const_iterator
94 found = stringToEnumeration_.find(str); 96 found = stringToEnumeration_.find(str);
95 97