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, "buflist", false,
[](StringView name, const Context& context) [](StringView name, const Context& context)
{ return join(BufferManager::instance() | { return join(BufferManager::instance() |
transform([](const std::unique_ptr<Buffer>& b) transform(std::mem_fn(&Buffer::display_name)), ':'); }
{ return b->display_name(); }), ':'); }
}, { }, {
"timestamp", false, "timestamp", false,
[](StringView name, const Context& context) -> String [](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 | return complete(prefix, cursor_pos, m_descs |
filter([](const OptionPtr& desc) filter([](const OptionPtr& desc)
{ return not (desc->flags() & OptionFlags::Hidden); }) | { return not (desc->flags() & OptionFlags::Hidden); }) |
transform([](const OptionPtr& desc) -> const String& transform(std::mem_fn(&OptionDesc::name)));
{ return desc->name(); }));
} }
} }

View File

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