[yoda-svn] r255 - in trunk: . include/YODA

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Aug 16 15:41:37 BST 2011


Author: buckley
Date: Tue Aug 16 15:41:37 2011
New Revision: 255

Log:
Note that 'using namespace std;' should be removed from Bin2D.h and Axis2D.h

Modified:
   trunk/TODO
   trunk/include/YODA/Axis2D.h
   trunk/include/YODA/Bin2D.h

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	Tue Aug 16 15:16:43 2011	(r254)
+++ trunk/TODO	Tue Aug 16 15:41:37 2011	(r255)
@@ -9,6 +9,10 @@
 * Rebinning: merges of n adjacent bins and global rebinning by integer factor
   (on widths or on bin groups?) (AB for 1D, MICHAL for 2D (done))
 
+* Remove the "using namespace std" from the Bin2D.h and Axis2D.h headers: you
+  should avoid publicly using namespaces in API headers since it pollutes the
+  global namespace for any users of the API.
+
 * Completely hide the Bin2D::isReal from public view: this is absolutely an
   internal implementation detail and should not be public in any way.
   Similarly, is there any reason to expose the isGriddy function publicly on

Modified: trunk/include/YODA/Axis2D.h
==============================================================================
--- trunk/include/YODA/Axis2D.h	Tue Aug 16 15:16:43 2011	(r254)
+++ trunk/include/YODA/Axis2D.h	Tue Aug 16 15:41:37 2011	(r255)
@@ -15,12 +15,9 @@
 #include <algorithm>
 #include <limits>
 
+/// @todo Remove this: don't use namespace std in API headers since it pollutes users' namespace.
 using namespace std;
 
-/// Big and small number for low/high search:
-const double LARGENUM = numeric_limits<double>::max();
-const double SMALLNUM = numeric_limits<double>::min();
-
 namespace YODA {
 
 
@@ -748,10 +745,10 @@
     /// function regenerates them. It should be run after any change is made to
     /// bin layout.
     void _regenDelimiters() {
-      double highEdgeX = SMALLNUM;
-      double highEdgeY = SMALLNUM;
-      double lowEdgeX = LARGENUM;
-      double lowEdgeY = LARGENUM;
+      double highEdgeX = numeric_limits<double>::min();
+      double highEdgeY = numeric_limits<double>::min();
+      double lowEdgeX = numeric_limits<double>::max();
+      double lowEdgeY = numeric_limits<double>::max();
 
       // Scroll through the bins and set the delimiters.
       for (size_t i = 0; i < _bins.size(); ++i) {

Modified: trunk/include/YODA/Bin2D.h
==============================================================================
--- trunk/include/YODA/Bin2D.h	Tue Aug 16 15:16:43 2011	(r254)
+++ trunk/include/YODA/Bin2D.h	Tue Aug 16 15:41:37 2011	(r255)
@@ -8,6 +8,8 @@
 #include <vector>
 #include <iostream>
 #include <cassert>
+
+/// @todo Remove this: don't use namespace std in API headers since it pollutes users' namespace.
 using namespace std;
 
 namespace YODA {


More information about the yoda-svn mailing list