Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deducing return type of map generator helper #1576

Merged
merged 6 commits into from
Mar 24, 2019

Conversation

ozars
Copy link
Contributor

@ozars ozars commented Mar 20, 2019

Description

map generator helper function requires its return type to be given explicitly if it is different from the type produced by the generator argument. This patch enables deducing the return type from the return type of given lambda function. Example:

This:

auto val = GENERATE(map<std::tuple<int, std::string>>([](int val) {
  return std::make_tuple(val, std::to_string(val));
}, range(-5, 5));

can be optionally written as:

auto val = GENERATE(map([](int val) {
  return std::make_tuple(val, std::to_string(val));
}, range(-5, 5));

ozars added 3 commits March 20, 2019 15:46
Giving the first template argument to map generator function to deduce
return type is now optional even if the return type is different from
the type generated by mapped generator.
@codecov
Copy link

codecov bot commented Mar 20, 2019

Codecov Report

Merging #1576 into master will increase coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1576      +/-   ##
==========================================
+ Coverage   80.58%   80.61%   +0.03%     
==========================================
  Files         121      121              
  Lines        3399     3394       -5     
==========================================
- Hits         2739     2736       -3     
+ Misses        660      658       -2

@codecov
Copy link

codecov bot commented Mar 20, 2019

Codecov Report

Merging #1576 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1576   +/-   ##
=======================================
  Coverage   80.58%   80.58%           
=======================================
  Files         121      121           
  Lines        3399     3399           
=======================================
  Hits         2739     2739           
  Misses        660      660

@horenmar horenmar merged commit 54089c4 into catchorg:master Mar 24, 2019
@horenmar horenmar added the Tweak label Mar 24, 2019
@ozars ozars deleted the deduce-map-type-feat branch March 24, 2019 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants