idvaluemap: minor style changes

This commit is contained in:
Maxime Coste 2013-03-27 18:42:00 +01:00
parent 29f79346c3
commit a3bc8dbc79
2 changed files with 9 additions and 10 deletions

View File

@ -4,7 +4,6 @@
#include "buffer.hh" #include "buffer.hh"
#include "dynamic_selection_list.hh" #include "dynamic_selection_list.hh"
#include "filter.hh" #include "filter.hh"
#include "idvaluemap.hh"
#include "memoryview.hh" #include "memoryview.hh"
namespace Kakoune namespace Kakoune

View File

@ -7,11 +7,11 @@
namespace Kakoune namespace Kakoune
{ {
template<typename _Id, typename _Value> template<typename Id, typename Value>
class idvaluemap class idvaluemap
{ {
public: public:
typedef std::pair<_Id, _Value> value_type; typedef std::pair<Id, Value> value_type;
typedef std::vector<value_type> container_type; typedef std::vector<value_type> container_type;
typedef typename container_type::iterator iterator; typedef typename container_type::iterator iterator;
typedef typename container_type::const_iterator const_iterator; typedef typename container_type::const_iterator const_iterator;
@ -23,10 +23,10 @@ public:
void append(value_type&& value) void append(value_type&& value)
{ {
m_content.push_back(std::forward<value_type>(value)); m_content.push_back(std::move(value));
} }
iterator find(const _Id& id) iterator find(const Id& id)
{ {
for (auto it = begin(); it != end(); ++it) for (auto it = begin(); it != end(); ++it)
{ {
@ -36,7 +36,7 @@ public:
return end(); return end();
} }
const_iterator find(const _Id& id) const const_iterator find(const Id& id) const
{ {
for (auto it = begin(); it != end(); ++it) for (auto it = begin(); it != end(); ++it)
{ {
@ -46,12 +46,12 @@ public:
return end(); return end();
} }
bool contains(const _Id& id) const bool contains(const Id& id) const
{ {
return find(id) != end(); return find(id) != end();
} }
void remove(const _Id& id) void remove(const Id& id)
{ {
for (auto it = m_content.begin(); it != m_content.end(); ++it) for (auto it = m_content.begin(); it != m_content.end(); ++it)
{ {
@ -63,10 +63,10 @@ public:
} }
} }
template<typename _Condition> template<typename Condition>
CandidateList complete_id_if(const String& prefix, CandidateList complete_id_if(const String& prefix,
ByteCount cursor_pos, ByteCount cursor_pos,
_Condition condition) const Condition condition) const
{ {
String real_prefix = prefix.substr(0, cursor_pos); String real_prefix = prefix.substr(0, cursor_pos);
CandidateList result; CandidateList result;