Commit 04858a4c authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'thread.AthenaKernel-20200224' into 'master'

AthenaKernel: Suppress some const_cast warnings in DataBucket; RNGWapper const fix.

See merge request !30561
parents e297f32f 7aaee3d3
///////////////////////// -*- C++ -*- /////////////////////////////
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "AthenaKernel/IRegisterTransient.h"
......@@ -9,6 +9,7 @@
#include "AthenaKernel/BaseInfo.h"
#include "AthenaKernel/ILockable.h"
#include "CxxUtils/AthUnlikelyMacros.h"
#include "CxxUtils/checker_macros.h"
#include <type_traits>
......@@ -69,7 +70,10 @@ template <typename U>
// cppcheck-suppress uninitMemberVar ; false positive
SG::DataBucket<T>::DataBucket(std::unique_ptr<U> data)
// Rely on our caller to retain constness.
: DataBucket (const_cast<typename std::remove_const<U>::type*> (data.release()))
: DataBucket ([] (U* ptr) { typedef typename std::remove_const<U>::type UNC;
UNC* tmp ATLAS_THREAD_SAFE = const_cast<UNC*> (ptr);
return tmp; }
(data.release()))
{
}
......
// -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ATHENAKERNEL_RNGWRAPPER_H
#define ATHENAKERNEL_RNGWRAPPER_H
......@@ -44,7 +44,7 @@ namespace ATHRNG{
/// Constructor takes a factory function which can instantiate a
/// CLHEP::HepRandomEngine and the number of event slots.
RNGWrapper(factoryFunc& genFact, size_t nSlots);
RNGWrapper(const factoryFunc& genFact, size_t nSlots);
~RNGWrapper();
/// Set the random seed using a string (e.g. algorithm name) and the
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "AthenaKernel/RNGWrapper.h"
#include "CLHEP/Random/RandomEngine.h"
ATHRNG::RNGWrapper::RNGWrapper(factoryFunc& genFact, size_t nSlots)
ATHRNG::RNGWrapper::RNGWrapper(const factoryFunc& genFact, size_t nSlots)
{
// Construct the random engines; one per event slot.
m_engines.reserve(nSlots);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment