diff options
Diffstat (limited to 'raul')
-rw-r--r-- | raul/Table.hpp | 4 | ||||
-rw-r--r-- | raul/TableImpl.hpp | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/raul/Table.hpp b/raul/Table.hpp index 4ab449c..9fd672a 100644 --- a/raul/Table.hpp +++ b/raul/Table.hpp @@ -21,6 +21,8 @@ #include <vector> #include <algorithm> +//#define TABLE_SORT_DEBUG + namespace Raul { @@ -98,7 +100,7 @@ public: iterator end() { return iterator(*this, size()); } private: -#ifndef NDEBUG +#ifdef TABLE_SORT_DEBUG bool is_sorted() const; #endif diff --git a/raul/TableImpl.hpp b/raul/TableImpl.hpp index c1ed938..1bb4699 100644 --- a/raul/TableImpl.hpp +++ b/raul/TableImpl.hpp @@ -31,7 +31,7 @@ namespace Raul { * std::vector::iterator or vice-versa should be shot and pissed on. */ -#ifndef NDEBUG +#ifdef TABLE_SORT_DEBUG template <typename K, typename T> bool Table<K,T>::is_sorted() const @@ -231,7 +231,9 @@ Table<K, T>::cram(const Table<K,T>& range) std::cerr << "********************************\n";*/ assert(size() == orig_size + range.size()); +#ifdef TABLE_SORT_DEBUG assert(is_sorted()); +#endif return make_pair(iterator(*this, insert_index), true); } @@ -299,7 +301,9 @@ Table<K,T>::insert(const std::pair<K, T>& entry) _entries[i] = entry; +#ifdef TABLE_SORT_DEBUG assert(is_sorted()); +#endif return std::make_pair(iterator(*this, i), true); } @@ -350,7 +354,9 @@ Table<K,T>::erase(iterator i) _entries.pop_back(); +#ifdef TABLE_SORT_DEBUG assert(is_sorted()); +#endif } @@ -383,7 +389,9 @@ Table<K,T>::erase_by_index(size_t first_index, size_t last_index) _entries.resize(size() - num_removed); +#ifdef TABLE_SORT_DEBUG assert(is_sorted()); +#endif } |