@@ -62,6 +62,9 @@ char* operator+( streampos&, char* );
62
62
63
63
ClassImp (RooAbsCollection);
64
64
65
+ namespace RooFit {
66
+ namespace Detail {
67
+
65
68
/* *
66
69
* Helper for hash-map-assisted finding of elements by name.
67
70
* Create this helper if finding of elements by name is needed.
@@ -71,7 +74,7 @@ ClassImp(RooAbsCollection);
71
74
* gets renamed, this counter will be increased, and the name to
72
75
* object map becomes invalid. In this case, it has to be recreated.
73
76
*/
74
- struct RooAbsCollection :: HashAssistedFind {
77
+ struct HashAssistedFind {
75
78
76
79
// / Inititalise empty hash map for fast finding by name.
77
80
template <typename It_t>
@@ -114,7 +117,8 @@ struct RooAbsCollection::HashAssistedFind {
114
117
std::size_t rooNameRegCounterWhereMapWasValid = 0 ;
115
118
};
116
119
117
-
120
+ }
121
+ }
118
122
119
123
120
124
// //////////////////////////////////////////////////////////////////////////////
@@ -1561,8 +1565,8 @@ void RooAbsCollection::insert(RooAbsArg* item) {
1561
1565
// //////////////////////////////////////////////////////////////////////////////
1562
1566
// / \param[in] flag Switch hash map on or off.
1563
1567
void RooAbsCollection::useHashMapForFind (bool flag) const {
1568
+ if (flag && !_hashAssistedFind) _hashAssistedFind = std::make_unique<HashAssistedFind>(_list.begin (), _list.end ());
1564
1569
if (!flag) _hashAssistedFind = nullptr ;
1565
- else _hashAssistedFind = std::make_unique<HashAssistedFind>(_list.begin (), _list.end ());
1566
1570
}
1567
1571
1568
1572
0 commit comments