И это язык со встроенным pattern matching?! И это язык со «всемогущим» фреймворком?!
template <class FI, class OI>
void doIt(FI const first, FI const last, OI res)
{
for(FI curr = first, next = first; curr != last; curr = next)
{
if(++next == last || *next != '{')
{
*res++ = std::make_pair(*curr, 1);
}
else
{
next = std::find(next, last, '}');
*res++ = std::make_pair(*curr, boost::lexical_cast<std::size_t>(std::string(boost::next(curr, 2), next++)));
}
}
}
P. S. Интересно, на сколько меня забанят?..