-
Notifications
You must be signed in to change notification settings - Fork 82
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/seqan/seqan3/EZHKWA3yyZraBuoN9pGGTHdgnnqZ |
Codecov Report
@@ Coverage Diff @@
## master #2583 +/- ##
=======================================
Coverage 98.23% 98.24%
=======================================
Files 269 270 +1
Lines 10561 10570 +9
=======================================
+ Hits 10375 10384 +9
Misses 186 186
Continue to review full report at Codecov.
|
There was a problem hiding this 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. 💅
There was a problem hiding this 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
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 ()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No hard feeling :)
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)>; |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty for verifying :)
//!\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>{}); | ||
} | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
//!\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...>{})); | ||
} |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently have
seqan3::list_traits::count<int, list_t>
(element) https://en.cppreference.com/w/cpp/algorithm/countseqan3::list_traits::find<double, list_t>
(element) https://en.cppreference.com/w/cpp/algorithm/findseqan3::list_traits::find_if<std::is_pointer, list_t>
(predicate) https://en.cppreference.com/w/cpp/algorithm/findseqan3::list_traits::remove<double, list_t>
(element) https://en.cppreference.com/w/cpp/algorithm/removeRemoves all elements satisfying specific criteria from the range [first, last) and returns a past-the-end iterator for the new end of the range.
I like that suggestion, I'll rename it remove
There was a problem hiding this comment.
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 :)
part of seqan/product_backlog#124