]> git.lyx.org Git - lyx.git/blobdiff - src/support/translator.h
export patch from Dekel
[lyx.git] / src / support / translator.h
index 7c6fcdf360e17e5d508c76db6180a77af66e4671..9e9fb154493d7f5943765596bb832a5559b62634 100644 (file)
 #ifndef TRANSLATOR_H
 #define TRANSLATOR_H
 
-
 #include <vector>
 #include <utility>
 #include <algorithm>
 #include <functional>
 
+#include "support/LAssert.h"
+
 // Functors used in the template.
 template<typename T1, typename T2>
 class equal_1st_in_pair {
@@ -57,6 +58,8 @@ class Translator {
 public:
     typedef T1 first_argument_type;
     typedef T2 second_argument_type;
+    typedef std::pair<T1, T2> MapPair;
+    typedef std::vector<MapPair> Map;
 
     /// c-tor.
     Translator(T1 const & t1, T2 const & t2) 
@@ -70,9 +73,7 @@ public:
 
     /// Find the mapping for the first argument
     T2 const & find(T1 const & first) const {
-#ifdef ENABLE_ASSERTIONS
         Assert( ! map.empty());
-#endif
 
         // For explanation see the next find() function.
         Map::const_iterator it =
@@ -89,9 +90,7 @@ public:
 
     /// Find the mapping for the second argument
     T1 const & find(T2 const & second) const {
-#ifdef ENABLE_ASSERTIONS
         Assert( ! map.empty());
-#endif
 
         // The idea is as follows:
         // find_if() will try to compare the data in the vector with the value.
@@ -117,14 +116,10 @@ public:
     }
 
 private:
-    typedef std::pair<T1, T2> MapPair;
-    typedef std::vector<MapPair> Map;
-
     Map map;
 
-    const T1 default_t1;
-    const T2 default_t2;
-
+    T1 const default_t1;
+    T2 const default_t2;
 };
 
 #endif