More transform(...) filter cleanup using mem_fn when possible

This commit is contained in:
Maxime Coste 2016-10-11 00:32:40 +01:00
parent 8b6eba8208
commit 780a4605fa
3 changed files with 3 additions and 7 deletions

View File

@ -67,8 +67,7 @@ void register_env_vars()
"buflist", false,
[](StringView name, const Context& context)
{ return join(BufferManager::instance() |
transform([](const std::unique_ptr<Buffer>& b)
{ return b->display_name(); }), ':'); }
transform(std::mem_fn(&Buffer::display_name)), ':'); }
}, {
"timestamp", false,
[](StringView name, const Context& context) -> String

View File

@ -119,8 +119,7 @@ CandidateList OptionsRegistry::complete_option_name(StringView prefix,
return complete(prefix, cursor_pos, m_descs |
filter([](const OptionPtr& desc)
{ return not (desc->flags() & OptionFlags::Hidden); }) |
transform([](const OptionPtr& desc) -> const String&
{ return desc->name(); }));
transform(std::mem_fn(&OptionDesc::name)));
}
}

View File

@ -610,9 +610,7 @@ String selection_to_string(const Selection& selection)
String selection_list_to_string(const SelectionList& selections)
{
return join(selections | transform([](const Selection& s)
{ return selection_to_string(s); }),
':', false);
return join(selections | transform(selection_to_string), ':', false);
}
Selection selection_from_string(StringView desc)