From da960fea33fd7aeb464da5b1cac0a18248934448 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 16 Jan 2015 16:40:28 +0100 Subject: [PATCH] use std::advance to work with std::iterators --- include/mapnik/json/error_handler.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/mapnik/json/error_handler.hpp b/include/mapnik/json/error_handler.hpp index f1a4f8b1e..7432c10f0 100644 --- a/include/mapnik/json/error_handler.hpp +++ b/include/mapnik/json/error_handler.hpp @@ -38,7 +38,10 @@ struct error_handler Iterator err_pos, boost::spirit::info const& what) const { std::stringstream s; - s << what << " expected but got: " << std::string(err_pos, std::min(err_pos + 16,last)); + auto start = err_pos; + std::advance(err_pos,16); + auto end = err_pos; + s << what << " expected but got: " << std::string(start, end); throw std::runtime_error(s.str()); } };