]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/interval.tcc
Issue 4550 (2/2) Avoid "using namespace std;" in included files
[lilypond.git] / flower / include / interval.tcc
index 2f002a7e008e24e438d306299268e2aeb8290013..f0973b8b099737c2da329d5c3f32017b55f921ee 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1996--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -27,7 +27,6 @@
 
 // MacOS 10.3 problems:
 // #include <cmath>
-using namespace std;
 
 template<class T>
 int
@@ -70,14 +69,14 @@ void
 Interval_t<T>::set_empty ()
 {
   at (LEFT) = (T) infinity ();
-  at (RIGHT) = (T) -infinity ();
+  at (RIGHT) = (T) - infinity ();
 }
 
 template<class T>
 void
 Interval_t<T>::set_full ()
 {
-  at (LEFT) = (T) -infinity ();
+  at (LEFT) = (T) - infinity ();
   at (RIGHT) = (T) infinity ();
 }
 
@@ -103,8 +102,8 @@ template<class T>
 void
 Interval_t<T>::unite (Interval_t<T> h)
 {
-  at (LEFT) = min (h.at (LEFT), at (LEFT));
-  at (RIGHT) = max (h.at (RIGHT), at (RIGHT));
+  at (LEFT) = std::min (h.at (LEFT), at (LEFT));
+  at (RIGHT) = std::max (h.at (RIGHT), at (RIGHT));
 }
 
 /* Unites h and this interval, but in such a way
@@ -136,20 +135,20 @@ template<class T>
 void
 Interval_t<T>::intersect (Interval_t<T> h)
 {
-  at (LEFT) = max (h.at (LEFT), at (LEFT));
-  at (RIGHT) = min (h.at (RIGHT), at (RIGHT));
+  at (LEFT) = std::max (h.at (LEFT), at (LEFT));
+  at (RIGHT) = std::min (h.at (RIGHT), at (RIGHT));
 }
 
 template<class T>
-string
+std::string
 Interval_t<T>::to_string () const
 {
   if (is_empty ())
     return "[empty]";
-  string s ("[");
+  std::string s ("[");
 
-  return (s + T_to_string (at (LEFT)) + string (",")
-         + T_to_string (at (RIGHT)) + string ("]"));
+  return (s + T_to_string (at (LEFT)) + std::string (",")
+          + T_to_string (at (RIGHT)) + std::string ("]"));
 }
 
 template<class T>
@@ -159,7 +158,7 @@ Interval_t<T>::contains (T r) const
   return r >= at (LEFT) && r <= at (RIGHT);
 }
 
-#define INTERVAL__INSTANTIATE(T) struct Interval_t<T>;                 \
+#define INTERVAL__INSTANTIATE(T) struct Interval_t<T>;                  \
   template int Interval__compare (const Interval_t<T> &, Interval_t<T> const &)
 
 #endif // INTERVAL_TCC