lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5253] Move convert_vector_type()


From: Greg Chicares
Subject: [lmi-commits] [5253] Move convert_vector_type()
Date: Mon, 15 Aug 2011 01:18:47 +0000

Revision: 5253
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5253
Author:   chicares
Date:     2011-08-15 01:18:47 +0000 (Mon, 15 Aug 2011)
Log Message:
-----------
Move convert_vector_type()

Modified Paths:
--------------
    lmi/trunk/input_seq_helpers.hpp
    lmi/trunk/mec_input.cpp
    lmi/trunk/yare_input.cpp

Modified: lmi/trunk/input_seq_helpers.hpp
===================================================================
--- lmi/trunk/input_seq_helpers.hpp     2011-08-15 00:49:50 UTC (rev 5252)
+++ lmi/trunk/input_seq_helpers.hpp     2011-08-15 01:18:47 UTC (rev 5253)
@@ -28,8 +28,13 @@
 
 #include "alert.hpp"
 #include "input_sequence.hpp"
+#include "mc_enum.hpp"
 #include "so_attributes.hpp"
+#include "tn_range.hpp"
 
+#include <boost/type_traits/is_enum.hpp>
+#include <boost/utility/enable_if.hpp>
+
 #include <map>
 #include <string>
 #include <vector>
@@ -103,5 +108,34 @@
     }
 } // namespace detail
 
+template<typename T>
+std::vector<T> convert_vector_type
+    (std::vector<mc_enum<T> > const& ve
+    ,typename boost::enable_if<boost::is_enum<T> >::type* = 0
+    )
+{
+    std::vector<T> z;
+    typename std::vector<mc_enum<T> >::const_iterator ve_i;
+    for(ve_i = ve.begin(); ve_i != ve.end(); ++ve_i)
+        {
+        z.push_back(ve_i->value());
+        }
+    return z;
+}
+
+template<typename Number, typename Trammel>
+std::vector<Number> convert_vector_type
+    (std::vector<tn_range<Number,Trammel> > const& vr
+    )
+{
+    std::vector<Number> z;
+    typename std::vector<tn_range<Number,Trammel> >::const_iterator vr_i;
+    for(vr_i = vr.begin(); vr_i != vr.end(); ++vr_i)
+        {
+        z.push_back(vr_i->value());
+        }
+    return z;
+}
+
 #endif // input_seq_helpers_hpp
 

Modified: lmi/trunk/mec_input.cpp
===================================================================
--- lmi/trunk/mec_input.cpp     2011-08-15 00:49:50 UTC (rev 5252)
+++ lmi/trunk/mec_input.cpp     2011-08-15 01:18:47 UTC (rev 5253)
@@ -35,14 +35,14 @@
 #include "database.hpp"
 #include "dbnames.hpp"
 #include "global_settings.hpp"
-#include "input_seq_helpers.hpp"
+#include "input_seq_helpers.hpp"        // convert_vector(), 
convert_vector_type()
 #include "map_lookup.hpp"
-#include "miscellany.hpp" // lmi_array_size()
+#include "miscellany.hpp"               // lmi_array_size()
 
-#include <algorithm>      // std::max()
+#include <algorithm>                    // std::max()
 #include <limits>
 #include <sstream>
-#include <utility>        // std::pair
+#include <utility>                      // std::pair
 
 template class xml_serializable<mec_input>;
 
@@ -682,23 +682,6 @@
     RealizeAllSequenceInput(false);
 }
 
-namespace
-{
-template<typename Number, typename Trammel>
-std::vector<Number> convert_vector_type
-    (std::vector<tn_range<Number,Trammel> > const& vr
-    )
-{
-    std::vector<Number> z;
-    typename std::vector<tn_range<Number,Trammel> >::const_iterator vr_i;
-    for(vr_i = vr.begin(); vr_i != vr.end(); ++vr_i)
-        {
-        z.push_back(vr_i->value());
-        }
-    return z;
-}
-} // Unnamed namespace.
-
 std::vector<double> mec_input::FlatExtraRealized() const
 {
     return convert_vector_type<double>(FlatExtraRealized_);

Modified: lmi/trunk/yare_input.cpp
===================================================================
--- lmi/trunk/yare_input.cpp    2011-08-15 00:49:50 UTC (rev 5252)
+++ lmi/trunk/yare_input.cpp    2011-08-15 01:18:47 UTC (rev 5253)
@@ -29,45 +29,11 @@
 #include "yare_input.hpp"
 
 #include "input.hpp"
-#include "miscellany.hpp" // each_equal()
+#include "input_seq_helpers.hpp"        // convert_vector_type()
+#include "miscellany.hpp"               // each_equal()
 
-#include <boost/type_traits/is_enum.hpp>
-#include <boost/utility/enable_if.hpp>
+#include <numeric>                      // std::accumulate()
 
-#include <numeric>        // std::accumulate()
-
-namespace
-{
-template<typename T>
-std::vector<T> convert_vector_type
-    (std::vector<mc_enum<T> > const& ve
-    ,typename boost::enable_if<boost::is_enum<T> >::type* = 0
-    )
-{
-    std::vector<T> z;
-    typename std::vector<mc_enum<T> >::const_iterator ve_i;
-    for(ve_i = ve.begin(); ve_i != ve.end(); ++ve_i)
-        {
-        z.push_back(ve_i->value());
-        }
-    return z;
-}
-
-template<typename Number, typename Trammel>
-std::vector<Number> convert_vector_type
-    (std::vector<tn_range<Number,Trammel> > const& vr
-    )
-{
-    std::vector<Number> z;
-    typename std::vector<tn_range<Number,Trammel> >::const_iterator vr_i;
-    for(vr_i = vr.begin(); vr_i != vr.end(); ++vr_i)
-        {
-        z.push_back(vr_i->value());
-        }
-    return z;
-}
-} // Unnamed namespace.
-
 yare_input::yare_input(Input const& z)
 {
 // TODO ?? This temporarily works around a deeper defect. See:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]