diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-07-20 15:42:23 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-07-20 15:55:44 +0200 |
commit | 91a6ea5d6f75846983ab53ef477aa063786ac3fe (patch) | |
tree | 048e2c9046c5dfb557ec0b80ed1b205523b69911 /o3tl | |
parent | 1ac4c2cf795e5bc2883ae0a76955e981fb1edee2 (diff) |
Unnecessary sorted_vector_compare
Change-Id: I813629a2614f99035ab1b873ee34c203729c7367
Diffstat (limited to 'o3tl')
-rw-r--r-- | o3tl/inc/o3tl/sorted_vector.hxx | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/o3tl/inc/o3tl/sorted_vector.hxx b/o3tl/inc/o3tl/sorted_vector.hxx index 0386680a9914..b3ffc4ff8d41 100644 --- a/o3tl/inc/o3tl/sorted_vector.hxx +++ b/o3tl/inc/o3tl/sorted_vector.hxx @@ -17,17 +17,6 @@ namespace o3tl { -/** Helper template */ -template <class Value, class Compare> -class sorted_vector_compare : public Compare -{ -public: - bool operator()(const Value& lhs, const Value& rhs) const - { - return Compare::operator()(lhs, rhs); - } -}; - /** Represents a sorted vector of values. @tpl Value class of item to be stored in container @@ -36,7 +25,6 @@ public: template <class Value, class Compare = std::less<Value> > class sorted_vector : private std::vector<Value> - , private sorted_vector_compare<Value, Compare> { private: typedef typename std::vector<Value> base_t; @@ -44,7 +32,6 @@ private: public: typedef typename std::vector<Value>::const_iterator const_iterator; typedef typename std::vector<Value>::size_type size_type; - typedef sorted_vector_compare<Value, Compare> MyCompare; using base_t::clear; using base_t::erase; @@ -113,8 +100,7 @@ public: const_iterator lower_bound( const Value& x ) const { - const MyCompare& me = *this; - return std::lower_bound( base_t::begin(), base_t::end(), x, me ); + return std::lower_bound( base_t::begin(), base_t::end(), x, Compare() ); } /* Searches the container for an element with a value of x @@ -159,14 +145,12 @@ private: /** just makes the code easier to read */ bool less_than(const Value& lhs, const Value& rhs) const { - const MyCompare& me = *this; - return me.operator()(lhs, rhs); + return Compare().operator()(lhs, rhs); } iterator lower_bound_nonconst( const Value& x ) { - const MyCompare& me = *this; - return std::lower_bound( base_t::begin(), base_t::end(), x, me ); + return std::lower_bound( base_t::begin(), base_t::end(), x, Compare() ); } typename base_t::iterator begin_nonconst() { return base_t::begin(); } |