]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTabular.cpp
Simplify featureAsString()... I don't understand why some people insist
[lyx.git] / src / insets / InsetTabular.cpp
index 487d03b6bccfda4abc0d17a780bb7a8c0ac1db02..935516d5cb78ab40356f4bba21f52236407c9981 100644 (file)
@@ -174,18 +174,6 @@ TabularFeature tabularFeature[] =
 };
 
 
-class FeatureEqual : public unary_function<TabularFeature, bool> {
-public:
-       FeatureEqual(Tabular::Feature feature)
-               : feature_(feature) {}
-       bool operator()(TabularFeature const & tf) const {
-               return tf.action == feature_;
-       }
-private:
-       Tabular::Feature feature_;
-};
-
-
 template <class T>
 string const write_attribute(string const & name, T const & t)
 {
@@ -500,13 +488,13 @@ void l_getline(istream & is, string & str)
 } // namespace
 
 
-string const featureAsString(Tabular::Feature feature)
+string const featureAsString(Tabular::Feature action)
 {
-       TabularFeature * end = tabularFeature +
-               sizeof(tabularFeature) / sizeof(TabularFeature);
-       TabularFeature * it = find_if(tabularFeature, end,
-                                          FeatureEqual(feature));
-       return (it == end) ? string() : it->feature;
+       for (size_t i = 0; i != Tabular::LAST_ACTION; ++i) {
+               if (tabularFeature[i].action == action)
+                       return tabularFeature[i].feature;
+       }
+       return string();
 }