Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooSTLRefCountList.cxx
Go to the documentation of this file.
1 // Author: Stephan Hageboeck, CERN, 12/2018
2 /*****************************************************************************
3  * Project: RooFit *
4  * Authors: *
5  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
6  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
7  * *
8  * Copyright (c) 2000-2005, Regents of the University of California *
9  * and Stanford University. All rights reserved. *
10  * *
11  * Redistribution and use in source and binary forms, *
12  * with or without modification, are permitted according to the terms *
13  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
14  *****************************************************************************/
15 
16 #include "RooSTLRefCountList.h"
17 
18 #include "RooRefCountList.h"
19 #include "RooLinkedListIter.h"
20 #include "RooAbsArg.h"
21 #include <string>
22 
23 // Template specialisation used in RooAbsArg:
24 ClassImp(RooSTLRefCountList<RooAbsArg>);
25 
26 namespace RooFit {
27 namespace STLRefCountListHelpers {
28 /// Converts RooRefCountList to RooSTLRefCountList<RooAbsArg>.
29 /// This converter only yields lists with T=RooAbsArg. This is ok because this
30 /// the old RefCountList was only holding these.
31 RooSTLRefCountList<RooAbsArg> convert(const RooRefCountList& old) {
32  RooSTLRefCountList<RooAbsArg> newList;
33  newList.reserve(old.GetSize());
34 
35  auto it = old.fwdIterator();
36  for (RooAbsArg * elm = it.next(); elm != nullptr; elm = it.next()) {
37  newList.Add(elm, old.refCount(elm));
38  }
39 
40  return newList;
41 }
42 }
43 }
44