[Rivet-svn] rivet: Replace non-template Analysis::refData functions with C++...

Rivet Mercurial rivet at projects.hepforge.org
Thu Mar 30 16:45:02 BST 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/42bc1e6a31c0
branches:  release-2-5-x
changeset: 5727:42bc1e6a31c0
user:      Andy Buckley <andy at insectnation.org>
date:      Thu Mar 30 16:31:27 2017 +0100
description:
Replace non-template Analysis::refData functions with C++11 default T=Scatter2D.

diffs (truncated from 72 to 50 lines):

--- a/ChangeLog	Wed Mar 29 22:17:35 2017 +0100
+++ b/ChangeLog	Thu Mar 30 16:31:27 2017 +0100
@@ -1,3 +1,7 @@
+2017-03-30  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Replace non-template Analysis::refData functions with C++11 default T=Scatter2D.
+
 2017-03-29  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Allow yes/no and true/false values for LogX, etc. plot options.
--- a/include/Rivet/Analysis.hh	Wed Mar 29 22:17:35 2017 +0100
+++ b/include/Rivet/Analysis.hh	Thu Mar 30 16:31:27 2017 +0100
@@ -345,19 +345,8 @@
     //@{
 
     /// Get reference data for a named histo
-    /// @todo Move to the templated version when we have C++11 and can have a default fn template type
-    const YODA::Scatter2D& refData(const string& hname) const;
-
-    /// Get reference data for a numbered histo
-    /// @todo Move to the templated version when we have C++11 and can have a default fn template type
-    const YODA::Scatter2D& refData(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const;
-
-    /// Get reference data for a named histo
-    /// @todo Would be nice to just use these and ditch the S2D no-template version,
-    ///   but we need C++11 for default args in function templates
-    // template <typename T=Scatter2D>
     /// @todo SFINAE to ensure that the type inherits from YODA::AnalysisObject?
-    template <typename T>
+    template <typename T=YODA::Scatter2D>
     const T& refData(const string& hname) const {
       _cacheRefData();
       MSG_TRACE("Using histo bin edges for " << name() << ":" << hname);
@@ -369,11 +358,8 @@
     }
 
     /// Get reference data for a numbered histo
-    /// @todo Would be nice to just use these and ditch the S2D no-template version,
-    ///   but we need C++11 for default args in function templates
-    // template <typename T=Scatter2D>
     /// @todo SFINAE to ensure that the type inherits from YODA::AnalysisObject?
-    template <typename T>
+    template <typename T=YODA::Scatter2D>
     const T& refData(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const {
       const string hname = makeAxisCode(datasetId, xAxisId, yAxisId);
       return refData(hname);
--- a/src/Core/Analysis.cc	Wed Mar 29 22:17:35 2017 +0100
+++ b/src/Core/Analysis.cc	Thu Mar 30 16:31:27 2017 +0100
@@ -176,23 +176,6 @@
   }


More information about the Rivet-svn mailing list