Move SelectionList::set implementation out of the header

This commit is contained in:
Maxime Coste 2017-03-15 16:51:55 +00:00
parent 5705b6c6f9
commit a88e58763b
2 changed files with 11 additions and 10 deletions

View File

@ -42,6 +42,16 @@ void SelectionList::remove(size_t index)
if (index < m_main or m_main == m_selections.size())
--m_main;
}
void SelectionList::set(Vector<Selection> list, size_t main)
{
kak_assert(main < list.size());
m_selections = std::move(list);
m_main = main;
sort_and_merge_overlapping();
update_timestamp();
check_invariant();
}
namespace
{

View File

@ -105,6 +105,7 @@ struct SelectionList
Selection& operator[](size_t i) { return m_selections[i]; }
const Selection& operator[](size_t i) const { return m_selections[i]; }
void set(Vector<Selection> list, size_t main);
SelectionList& operator=(Vector<Selection> list)
{
const size_t main_index = list.size()-1;
@ -112,16 +113,6 @@ struct SelectionList
return *this;
}
void set(Vector<Selection> list, size_t main)
{
kak_assert(main < list.size());
m_selections = std::move(list);
m_main = main;
sort_and_merge_overlapping();
update_timestamp();
check_invariant();
}
using iterator = Vector<Selection>::iterator;
iterator begin() { return m_selections.begin(); }
iterator end() { return m_selections.end(); }