diff --git a/generator/feature_builder.cpp b/generator/feature_builder.cpp index 8aba7ab405..83864201e1 100644 --- a/generator/feature_builder.cpp +++ b/generator/feature_builder.cpp @@ -260,11 +260,22 @@ void FeatureBuilder1::RemoveUselessNames() if (!m_params.name.IsEmpty() && !IsCoastCell()) { using namespace feature; - - static TypeSetChecker const checkBoundary({ "boundary", "administrative" }); + // Use lambda syntax to correctly compile according to standard: + // http://en.cppreference.com/w/cpp/algorithm/remove + // The signature of the predicate function should be equivalent to the following: + // bool pred(const Type &a); + // Without it on clang-libc++ on Linux we get: + // candidate template ignored: substitution failure + // [with _Tp = bool (unsigned int) const]: reference to function type 'bool (unsigned int) const' cannot have 'const' + // qualifier + auto const typeRemover = [](uint32_t type) + { + static TypeSetChecker const checkBoundary({ "boundary", "administrative" }); + return checkBoundary.IsEqual(type); + }; TypesHolder types(GetFeatureBase()); - if (types.RemoveIf(bind(&TypeSetChecker::IsEqual, cref(checkBoundary), _1))) + if (types.RemoveIf(typeRemover)) { pair const range = GetDrawableScaleRangeForRules(types, RULE_ANY_TEXT); if (range.first == -1) diff --git a/generator/osm_translator.hpp b/generator/osm_translator.hpp index d92aedcfab..074f06eda8 100644 --- a/generator/osm_translator.hpp +++ b/generator/osm_translator.hpp @@ -312,8 +312,8 @@ class OsmToFeatureTranslator if (type != ftype::GetEmptyValue() && !ft.GetName().empty()) { m_places.ReplaceEqualInRect(Place(ft, type), - bind(&Place::IsEqual, _1, _2), - bind(&Place::IsBetterThan, _1, _2)); + [](Place const & p1, Place const & p2) { return p1.IsEqual(p2); }, + [](Place const & p1, Place const & p2) { return p1.IsBetterThan(p2); }); } else m_emitter(ft); diff --git a/graphics/opengl/base_texture.cpp b/graphics/opengl/base_texture.cpp index 81b81005f3..8e35556993 100644 --- a/graphics/opengl/base_texture.cpp +++ b/graphics/opengl/base_texture.cpp @@ -80,7 +80,7 @@ namespace graphics { if (queue) { - queue->processFn(bind(&BaseTexture::makeCurrent, this, (graphics::PacketsQueue*)0)); + queue->processFn([this](){ makeCurrent(0); }); return; } diff --git a/gui/controller.cpp b/gui/controller.cpp index d71189d02c..7c18e3e889 100644 --- a/gui/controller.cpp +++ b/gui/controller.cpp @@ -189,9 +189,9 @@ namespace gui screen->beginFrame(); - math::Matrix m = math::Identity(); - - for_each(m_Elements.begin(), m_Elements.end(), bind(&Element::draw, _1, screen, m)); + math::Matrix const m = math::Identity(); + for (auto const & element : m_Elements) + element->draw(screen, m); screen->endFrame(); } @@ -210,7 +210,8 @@ namespace gui void Controller::SetStringsBundle(StringsBundle const * bundle) { m_bundle = bundle; - for_each(m_Elements.begin(), m_Elements.end(), bind(&Element::setIsDirtyLayout, _1, true)); + for (auto const & element : m_Elements) + element->setIsDirtyLayout(true); } StringsBundle const * Controller::GetStringsBundle() const @@ -230,17 +231,22 @@ namespace gui void Controller::UpdateElements() { - for_each(m_Elements.begin(), m_Elements.end(), bind(&Element::update, _1)); + for (auto const & element : m_Elements) + element->update(); } void Controller::PurgeElements() { - for_each(m_Elements.begin(), m_Elements.end(), bind(&Element::purge, _1)); - for_each(m_Elements.begin(), m_Elements.end(), bind(&Element::setIsDirtyLayout, _1, true)); + for (auto const & element : m_Elements) + { + element->purge(); + element->setIsDirtyLayout(true); + } } void Controller::LayoutElements() { - for_each(m_Elements.begin(), m_Elements.end(), bind(&Element::checkDirtyLayout, _1)); + for (auto const & element : m_Elements) + element->checkDirtyLayout(); } } diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index 1808432f10..17d85c06e2 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -310,8 +310,10 @@ void BookmarkManager::DrawItems(Drawer * drawer) const pScreen->beginFrame(); PaintOverlayEvent event(drawer, screen); - for_each(m_userMarkLayers.begin(), m_userMarkLayers.end(), bind(&UserMarkContainer::Draw, _1, event, m_cache)); - for_each(m_categories.begin(), m_categories.end(), bind(&BookmarkManager::DrawCategory, this, _1, event)); + for (auto const & layer : m_userMarkLayers) + layer->Draw(event, m_cache); + for (auto const & category : m_categories) + DrawCategory(category, event); m_routeRenderer->Render(pScreen, screen); m_selection.Draw(event, m_cache);