edmNew::DetSetVector
and edmNew::DetSet
are not fully const
-correct
#46917
Labels
edmNew::DetSetVector
and edmNew::DetSet
are not fully const
-correct
#46917
As shown in
cmssw/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc
Lines 764 to 765 in 87f3f24
cmssw/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc
Line 790 in 87f3f24
one can get a non-const
edmNew::DetSet<T>
by de-referencing anedmNew::DetSetVector<T>::const_iterator
.The problems stem from
edmNew::DetSet<T>
being a proxy type, i.e. it contains a pointer to the container held by the correspondingedmNew::DetSetVector
, and necessary offset therecmssw/DataFormats/Common/interface/DetSetNew.h
Lines 95 to 98 in 87f3f24
and it providing both
const
and non-const
interface.One specific problem is that (assuming I understood the behavior of
boost::transform_iterator
correctly, thecmssw/DataFormats/Common/interface/DetSetVectorNew.h
Line 186 in 87f3f24
returns a non-
const
edmNew::DetSet
. On the other hand, returningconst edmNew::DetSet
wouldn't help, becauseedmNew::DetSet
has default copy (and move) constructor/assignment, and therefore one can easily copy aconst edmNew::DetSet
into a non-const
edmNew::DetSet
.On a quick though I think the only certain way out would be to have separate "DetSet" types for the
const
and non-const
access of theedmNew::DetSetVector
.The text was updated successfully, but these errors were encountered: