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

remove #include<meta/meta.hpp> #2583

Merged
merged 17 commits into from
May 4, 2021
Merged

remove #include<meta/meta.hpp> #2583

merged 17 commits into from
May 4, 2021

Conversation

marehr
Copy link
Member

@marehr marehr commented Apr 30, 2021

@marehr marehr requested review from a team and Irallia and removed request for a team April 30, 2021 21:08
@vercel
Copy link

vercel bot commented Apr 30, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/seqan/seqan3/EZHKWA3yyZraBuoN9pGGTHdgnnqZ
✅ Preview: https://seqan3-git-fork-marehr-removemeta-seqan.vercel.app

@codecov
Copy link

codecov bot commented Apr 30, 2021

Codecov Report

Merging #2583 (08578f0) into master (fcad6ef) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2583   +/-   ##
=======================================
  Coverage   98.23%   98.24%           
=======================================
  Files         269      270    +1     
  Lines       10561    10570    +9     
=======================================
+ Hits        10375    10384    +9     
  Misses        186      186           
Impacted Files Coverage Δ
...clude/seqan3/alignment/pairwise/align_pairwise.hpp 100.00% <ø> (ø)
.../seqan3/alphabet/composite/alphabet_tuple_base.hpp 100.00% <100.00%> (ø)
...ude/seqan3/alphabet/composite/alphabet_variant.hpp 100.00% <100.00%> (ø)
include/seqan3/utility/type_list/type_list.hpp 100.00% <100.00%> (ø)
include/seqan3/utility/views/pairwise_combine.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 fcad6ef...08578f0. Read the comment docs.

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.

LGFM, only two style things. 💅

include/seqan3/utility/tuple/concept.hpp Show resolved Hide resolved
test/unit/utility/type_list/type_list_traits_test.cpp Outdated Show resolved Hide resolved
@marehr marehr requested review from a team and eseiler and removed request for a team May 3, 2021 11:17
Copy link
Member

@eseiler eseiler left a comment

Choose a reason for hiding this comment

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

I need to wrap my head around this a bit more, but I saw one thing

Comment on lines 140 to 143
static constexpr bool is_unique_component =
is_component<type> &&
(meta::find_index<component_list, type>::value == meta::reverse_find_index<component_list, type>::value);
(seqan3::list_traits::size<decltype(seqan3::list_traits::detail::filter_out<type>(component_list{}))>
== sizeof...(component_types) - 1);
Copy link
Member

@eseiler eseiler May 3, 2021

Choose a reason for hiding this comment

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

Suggested change
static constexpr bool is_unique_component =
is_component<type> &&
(meta::find_index<component_list, type>::value == meta::reverse_find_index<component_list, type>::value);
(seqan3::list_traits::size<decltype(seqan3::list_traits::detail::filter_out<type>(component_list{}))>
== sizeof...(component_types) - 1);
static constexpr bool is_unique_component = seqan3::list_traits::count<type, component_list> == 1;

?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm stupid xD Thank you, I was blended by the reverse.

static constexpr bool is_unique_component =
is_component<type> &&
(meta::find_index<component_list, type>::value == meta::reverse_find_index<component_list, type>::value);
static constexpr bool is_unique_component = (seqan3::list_traits::count<type, component_list> == 1);
Copy link
Member

Choose a reason for hiding this comment

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

Actually does not need parenthesis because it's not a concept, but they don't hurt either; actually easier to read with ()

Copy link
Member Author

Choose a reason for hiding this comment

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

No hard feeling :)

Comment on lines +103 to +105
template <typename ...elements_t>
inline constexpr auto all_elements_model_totally_ordered(seqan3::type_list<elements_t...>)
-> std::bool_constant<(std::totally_ordered<elements_t> && ... && true)>;
Copy link
Member

Choose a reason for hiding this comment

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

I think the behavior is the same

(Especially for empty lists I wasn't sure)

Do we need the && true? Because it also works without it (at least in 10 and 11).

Copy link
Member Author

Choose a reason for hiding this comment

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

The true makes it work for empty lists; In this case we already handle empty lists before, but it doesn't hurt here.

Copy link
Member Author

Choose a reason for hiding this comment

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

ty for verifying :)

Comment on lines 107 to 116
//!\brief A helper for seqan3::list_traits::detail::unique [recursion anchor]
template <typename query_t>
type_list<> filter_out(type_list<>);

//!\brief A helper for seqan3::list_traits::detail::unique [recursion]
template <typename query_t, typename head_t, typename ...pack_t>
auto filter_out(type_list<head_t, pack_t...>)
{
if constexpr(std::same_as<query_t, head_t>)
return filter_out<query_t>(type_list<pack_t...>{});
else
return concat(type_list<head_t>{}, filter_out<query_t>(type_list<pack_t...>{}));
}

//!\brief A replacement for meta::unique [recursion anchor]
inline constexpr type_list<> unique(type_list<>) { return {}; }

//!\brief A replacement for meta::unique [recursion]
template <typename head_t, typename ...pack_t>
auto unique(type_list<head_t, pack_t...>)
{
return concat(type_list<head_t>{}, unique(filter_out<head_t>(type_list<pack_t...>{})));
}

//!\brief A replacement for meta::reverse [recursion anchor]
inline constexpr type_list<> reverse(type_list<>) { return {}; }

//!\brief A replacement for meta::reverse [recursion]
template <typename head_t, typename ...pack_t>
auto reverse(type_list<head_t, pack_t...>)
{
return concat(reverse(type_list<pack_t...>{}), type_list<head_t>{});
}

Copy link
Member

Choose a reason for hiding this comment

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

This should get proper documentation, like the other traits.
It may be a follow-up issue

Copy link
Member Author

Choose a reason for hiding this comment

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

They are all in detail:: for now to skip the documentation :) but agree should be a follow-up

Comment on lines 107 to 119
//!\brief A helper for seqan3::list_traits::detail::unique [recursion anchor]
template <typename query_t>
type_list<> filter_out(type_list<>);

//!\brief A helper for seqan3::list_traits::detail::unique [recursion]
template <typename query_t, typename head_t, typename ...pack_t>
auto filter_out(type_list<head_t, pack_t...>)
{
if constexpr(std::same_as<query_t, head_t>)
return filter_out<query_t>(type_list<pack_t...>{});
else
return concat(type_list<head_t>{}, filter_out<query_t>(type_list<pack_t...>{}));
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove or remove_all would be a better name?

"remove query_t from the list pack_t..."
"remove all query_t from the list pack_t..."

remove (sometimes) implies that it stops after one hit, that's why remove_all might be better

"filter out" sounds a bit weird and the cpp20-me expects to pass a predicate :)

Copy link
Member Author

@marehr marehr May 3, 2021

Choose a reason for hiding this comment

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

We currently have

I like that suggestion, I'll rename it remove

Copy link
Member Author

Choose a reason for hiding this comment

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

Because of your ingenious idea of using count == 1, I could throw away the unique and remove :)

@marehr marehr requested a review from eseiler May 3, 2021 21:13
@eseiler eseiler merged commit 9c9e01b into seqan:master May 4, 2021
@marehr marehr deleted the remove_meta branch May 4, 2021 13: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