Skip to content

TrackingVolumeCreator::CreateTrackingVolume rm un-needed const leading eventually to const_cast

TrackingVolumeCreator::CreateTrackingVolume rm un-needed const leading eventually to const_cast

Allow to unmark NOT_SAFE methods --> they can pass the checker.

The pattern causing the issue is

  1. we create something as non-const
  2. In an interface we qualify a ptr to it as const
  3. later on we do const_cast

In principle this is allowed (since was created as non-const). But this is not easy for the checker (or the compiler) to know.

In the Layers case, we create ptr to non const layer, then we push them to vector of ptr to const Layers, when we want to manipulate deep down in the tool chain we do a const_cast

The line removed (deep in the call chain of tools) is basically this one:

Trk::Layer* mutableLayer = const_cast<Trk::Layer*>(layerIter);
Edited by Christos Anastopoulos

Merge request reports