Skip to content

Add free functions for using apply directly on vectors.#185

Merged
akleeman merged 3 commits intoswift-nav:masterfrom
akleeman:apply_free_function
Nov 6, 2019
Merged

Add free functions for using apply directly on vectors.#185
akleeman merged 3 commits intoswift-nav:masterfrom
akleeman:apply_free_function

Conversation

@akleeman
Copy link
Copy Markdown
Contributor

@akleeman akleeman commented Nov 6, 2019

This change lets you do things like:

std::vector<T> foo;
const auto bar = apply(foo, convert_foo_to_bar);

It's not unlike std::transform but supports situations where the apply function returns void and doesn't require knowing the type of the transformed type ahead of time.

@akleeman akleeman requested a review from jbangelo November 6, 2019 18:42
Copy link
Copy Markdown
Contributor

@jbangelo jbangelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. It seems like they are essentially doing std::for_each or std::transform?

@akleeman
Copy link
Copy Markdown
Contributor Author

akleeman commented Nov 6, 2019

@jbangelo yeah ... they pretty much are. I just dislike the syntax for transform etc. (Though maybe I should use it internally).

@jbangelo
Copy link
Copy Markdown
Contributor

jbangelo commented Nov 6, 2019

I don't see a reason to suddenly start. I agree that they are clunky to use, requiring the pairs of iterators. The "range" versions in C++20 are nicer to use.

@akleeman akleeman merged commit 09266bf into swift-nav:master Nov 6, 2019
@akleeman akleeman deleted the apply_free_function branch November 6, 2019 21:36
sbmueller pushed a commit that referenced this pull request Jul 9, 2025
…grind memcheck [AP-3695] (#185) (#516)

Automated PR by Jenkins. If CI has passed successfully, merge away!



**cmake**  361035b6  ->  61cdba17
- 61cdba17 : Add option for suppression file in valgrind memcheck
[AP-3695] (swift-nav/cmake#185)


This pull request was created by
https://jenkins.ci.swift-nav.com/job/CI%20Infra/job/submodule-update/20444/.


[AP-3695]:
https://swift-nav.atlassian.net/browse/AP-3695?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants