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

[FIX] parsing containers of enums not working #2381

Merged
merged 3 commits into from
Feb 17, 2021

Conversation

eseiler
Copy link
Member

@eseiler eseiler commented Feb 16, 2021

In #1196, we forgot to allow for, e.g. std::vector<foo::bar>, where foo::bar is an enum.

@eseiler eseiler requested a review from Irallia February 16, 2021 07:21
@codecov
Copy link

codecov bot commented Feb 16, 2021

Codecov Report

Merging #2381 (944ed2b) into master (a1d5d4d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2381   +/-   ##
=======================================
  Coverage   98.21%   98.21%           
=======================================
  Files         265      265           
  Lines       10806    10820   +14     
=======================================
+ Hits        10613    10627   +14     
  Misses        193      193           
Impacted Files Coverage Δ
...ude/seqan3/argument_parser/detail/format_parse.hpp 96.80% <100.00%> (ø)
include/seqan3/alphabet/alphabet_base.hpp 100.00% <0.00%> (ø)
include/seqan3/alphabet/adaptation/char.hpp 100.00% <0.00%> (ø)
include/seqan3/alphabet/adaptation/uint.hpp 100.00% <0.00%> (ø)
include/seqan3/alphabet/aminoacid/aa10li.hpp 100.00% <0.00%> (ø)
...clude/seqan3/alphabet/aminoacid/aminoacid_base.hpp 100.00% <0.00%> (ø)
...n3/search/dream_index/interleaved_bloom_filter.hpp 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1d5d4d...944ed2b. Read the comment docs.

@eseiler eseiler changed the title [FIX] parsing countainers of enums not working [FIX] parsing containers of enums not working Feb 16, 2021
Copy link
Contributor

@Irallia Irallia left a comment

Choose a reason for hiding this comment

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

Thank you, for the fast help!
LGFM :)

Copy link
Member

@marehr marehr 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, but can we generalise it ?

Comment on lines 350 to 351
requires input_stream_over<std::istringstream, typename container_option_t::value_type> ||
named_enumeration<typename container_option_t::value_type>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
requires input_stream_over<std::istringstream, typename container_option_t::value_type> ||
named_enumeration<typename container_option_t::value_type>
requires requires (std::ranges::value_type<container_option_t> & container_value, std::string const & in)
{
{ parse_option_value(container_value, in) } -> std::same_as<option_parse_result>;
}

wouldn't that be more general? If it is a container, try to defer to its value_type (that's exactly what the function does). The only problem would be container that have themselves as value_type xD

Since we also have overloads for bool and other things, I guess std::vector<bool> does not work right now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Very good catch, std::vector<bool> did not work. The concept was hard to write... tldr: you need an instance of the class if you want to test member functions, but the compiler does not necessarily tell you :)

I opted to use container_option_t::value_type instead of the ranges thing:

  1. Doesn't seem to be currently included (less includes :) )
  2. It currently requires sequence_container, which requires value_type to be defined

If this is good, you can squash

Copy link
Member

Choose a reason for hiding this comment

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

Very nice!

@marehr marehr self-requested a review February 17, 2021 09:01
@eseiler eseiler merged commit 0721fec into seqan:master Feb 17, 2021
@eseiler eseiler deleted the fix/enum_container_parse branch May 14, 2021 14:11
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.

3 participants