Bariskas / oop

Лабораторные по ООП 2 курс ИПС
0 stars 0 forks source link

Замечания по HTML Decode #5

Open alexey-malov opened 8 years ago

alexey-malov commented 8 years ago
1>c:\teaching\2016\ips\ibulaev\oop\lab02\2_5_htmldecode\htmldecode.cpp(37): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
alexey-malov commented 8 years ago
alexey-malov commented 8 years ago
alexey-malov commented 8 years ago
static const vector<pair<string, string>> decodeTable = {{"apos;", "'"}, ...};

...
string str;
size_t pos;
auto it = find_if(decodeTable.begin(), decodeTable.end(), [&](auto & entity){
   return (str.compare(entity.first, pos, entity.first.length() == 0)
});
// replace with it->second if it != decodeTable.end()