diff --git a/drape/pointers.hpp b/drape/pointers.hpp index 005ff1fd37..541569d512 100644 --- a/drape/pointers.hpp +++ b/drape/pointers.hpp @@ -109,6 +109,8 @@ public: template operator ref_ptr() const { + STATIC_ASSERT(is_base_of::value || is_base_of::value || + is_void::value || is_void::value); return ref_ptr(static_cast(m_ptr), m_isOwnerUnique); } diff --git a/drape/texture_manager.cpp b/drape/texture_manager.cpp index d445f8cd5e..23570d25a3 100644 --- a/drape/texture_manager.cpp +++ b/drape/texture_manager.cpp @@ -93,41 +93,37 @@ TextureManager::GlyphRegion::GlyphRegion() float TextureManager::GlyphRegion::GetOffsetX() const { ASSERT(m_info->GetType() == Texture::Glyph, ()); - ref_ptr info = static_cast>(m_info); - return info->GetMetrics().m_xOffset; + return ref_ptr(m_info)->GetMetrics().m_xOffset; } float TextureManager::GlyphRegion::GetOffsetY() const { ASSERT(m_info->GetType() == Texture::Glyph, ()); - ref_ptr info = static_cast>(m_info); - return info->GetMetrics().m_yOffset; + return ref_ptr(m_info)->GetMetrics().m_yOffset; } float TextureManager::GlyphRegion::GetAdvanceX() const { ASSERT(m_info->GetType() == Texture::Glyph, ()); - ref_ptr info = static_cast>(m_info); - return info->GetMetrics().m_xAdvance; + return ref_ptr(m_info)->GetMetrics().m_xAdvance; } float TextureManager::GlyphRegion::GetAdvanceY() const { ASSERT(m_info->GetType() == Texture::Glyph, ()); - ref_ptr info = static_cast>(m_info); - return info->GetMetrics().m_yAdvance; + return ref_ptr(m_info)->GetMetrics().m_yAdvance; } uint32_t TextureManager::StippleRegion::GetMaskPixelLength() const { ASSERT(m_info->GetType() == Texture::StipplePen, ()); - return static_cast>(m_info)->GetMaskPixelLength(); + return ref_ptr(m_info)->GetMaskPixelLength(); } uint32_t TextureManager::StippleRegion::GetPatternPixelLength() const { ASSERT(m_info->GetType() == Texture::StipplePen, ()); - return static_cast>(m_info)->GetPatternPixelLength(); + return ref_ptr(m_info)->GetPatternPixelLength(); } void TextureManager::Release() diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index b30df38e6c..818c8a9f5d 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -108,7 +108,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) { case Message::FlushTile: { - ref_ptr msg = static_cast>(message); + ref_ptr msg = message; dp::GLState const & state = msg->GetState(); TileKey const & key = msg->GetKey(); drape_ptr bucket = msg->AcceptBuffer(); @@ -124,14 +124,14 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) case Message::FinishReading: { - ref_ptr msg = static_cast>(message); + ref_ptr msg = message; m_tileTree->FinishTiles(msg->GetTiles(), GetCurrentZoomLevel()); break; } case Message::Resize: { - ref_ptr rszMsg = static_cast>(message); + ref_ptr rszMsg = message; m_viewport = rszMsg->GetViewport(); m_view.OnSize(m_viewport.GetX0(), m_viewport.GetY0(), m_viewport.GetWidth(), m_viewport.GetHeight()); @@ -153,14 +153,14 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) } case Message::MyPositionShape: - m_myPositionMark = static_cast>(message)->AcceptShape(); + m_myPositionMark = ref_ptr(message)->AcceptShape(); break; case Message::InvalidateRect: { // TODO(@kuznetsov): implement invalidation - //InvalidateRectMessage * m = static_cast>(message); + //ref_ptr m = message; //TTilesCollection keyStorage; //Message * msgToBackend = new InvalidateReadManagerRectMessage(keyStorage); //m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, @@ -171,7 +171,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) case Message::ClearUserMarkLayer: { - TileKey const & tileKey = static_cast>(message)->GetKey(); + TileKey const & tileKey = ref_ptr(message)->GetKey(); auto const functor = [&tileKey](drape_ptr const & g) { return g->GetTileKey() == tileKey; @@ -186,7 +186,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) } case Message::ChangeUserMarkLayerVisibility: { - ref_ptr m = static_cast>(message); + ref_ptr m = message; TileKey const & key = m->GetKey(); if (m->IsVisible()) m_userMarkVisibility.insert(key); @@ -196,7 +196,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) } case Message::GuiLayerRecached: { - ref_ptr msg = static_cast>(message); + ref_ptr msg = message; drape_ptr renderer = move(msg->AcceptRenderer()); renderer->Build(make_ref(m_gpuProgramManager)); if (m_guiRenderer == nullptr) diff --git a/std/type_traits.hpp b/std/type_traits.hpp index 1a56c51628..00baf5531f 100644 --- a/std/type_traits.hpp +++ b/std/type_traits.hpp @@ -10,21 +10,17 @@ using std::conditional; using std::enable_if; using std::is_arithmetic; +using std::is_base_of; using std::is_floating_point; using std::is_integral; using std::is_pod; using std::is_same; using std::is_signed; -using std::is_unsigned; -using std::make_signed; -using std::make_unsigned; -using std::underlying_type; -using std::is_same; -using std::is_signed; using std::is_standard_layout; using std::is_unsigned; using std::make_signed; using std::make_unsigned; +using std::underlying_type; using std::is_void; /// @todo clang on linux doesn't have is_trivially_copyable.