Skip to content

Commit

Permalink
Merge pull request #2583 from marehr/remove_meta
Browse files Browse the repository at this point in the history
remove #include<meta/meta.hpp>
  • Loading branch information
eseiler authored May 4, 2021
2 parents 54379f9 + 08578f0 commit 9c9e01b
Show file tree
Hide file tree
Showing 15 changed files with 208 additions and 147 deletions.
2 changes: 0 additions & 2 deletions include/seqan3/alignment/pairwise/align_pairwise.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include <tuple>
#include <type_traits>

#include <meta/meta.hpp>

#include <seqan3/alignment/pairwise/alignment_configurator.hpp>
#include <seqan3/alignment/pairwise/alignment_result.hpp>
#include <seqan3/alignment/pairwise/detail/concept.hpp>
Expand Down
100 changes: 66 additions & 34 deletions include/seqan3/alphabet/composite/alphabet_tuple_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
#include <seqan3/std/concepts>
#include <utility>

#include <meta/meta.hpp>

#include <seqan3/alphabet/alphabet_base.hpp>
#include <seqan3/alphabet/composite/detail.hpp>
#include <seqan3/alphabet/concept.hpp>
#include <seqan3/alphabet/detail/alphabet_proxy.hpp>
#include <seqan3/core/detail/pack_algorithm.hpp>
#include <seqan3/utility/detail/exposition_only_concept.hpp>
#include <seqan3/utility/detail/integer_traits.hpp>
#include <seqan3/utility/tuple/concept.hpp>
#include <seqan3/utility/type_list/type_list.hpp>
#include <seqan3/utility/type_list/traits.hpp>
#include <seqan3/utility/type_pack/traits.hpp>
#include <seqan3/utility/type_traits/detail/transformation_trait_or.hpp>
Expand Down Expand Up @@ -128,19 +128,16 @@ class alphabet_tuple_base :
(1 * ... * alphabet_size<component_types>),
void>; // no char type, because this is only semi_alphabet

//!\brief A meta::list The types of each component in the composite
using component_list = meta::list<component_types...>;
//!\brief A seqan3::type_list The types of each component in the composite
using component_list = seqan3::type_list<component_types...>;

//!\brief Is set to `true` if the type is contained in the type list.
template <typename type>
static constexpr bool is_component =
meta::in<component_list, type>::value;
static constexpr bool is_component = seqan3::list_traits::contains<type, component_list>;

//!\brief Is set to `true` if the type is uniquely contained in the type list.
template <typename type>
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);

// forward declaration: see implementation below
template <typename alphabet_type, size_t index>
Expand Down Expand Up @@ -178,9 +175,9 @@ class alphabet_tuple_base :
//!\brief Export this type's components and possibly the components' components in a visible manner.
//!\private
using seqan3_recursive_required_types =
meta::concat<component_list,
detail::transformation_trait_or_t<detail::recursive_required_types<component_types>,
meta::list<>>...>;
list_traits::concat<component_list,
detail::transformation_trait_or_t<detail::recursive_required_types<component_types>,
seqan3::type_list<>>...>;
//!\brief Make specialisations of this template identifiable in metapgrogramming contexts.
//!\private
static constexpr bool seqan3_alphabet_tuple_like = true;
Expand Down Expand Up @@ -241,9 +238,12 @@ class alphabet_tuple_base :
//!\endcond
constexpr explicit alphabet_tuple_base(indirect_component_type const alph) noexcept : alphabet_tuple_base{}
{
using component_type = meta::front<meta::find_if<component_list, detail::implicitly_convertible_from<indirect_component_type>>>;
component_type tmp(alph); // delegate construction
get<component_type>(*this) = tmp;
using component_predicate = detail::implicitly_convertible_from<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
component_type tmp(alph); // delegate construction
get<component_type>(*this) = tmp;
}

//!\cond
Expand All @@ -256,9 +256,12 @@ class alphabet_tuple_base :
detail::tuple_general_guard<derived_type, indirect_component_type, component_types...>> || ...))
constexpr explicit alphabet_tuple_base(indirect_component_type const alph) noexcept : alphabet_tuple_base{}
{
using component_type = meta::front<meta::find_if<component_list, detail::constructible_from<indirect_component_type>>>;
component_type tmp(alph); // delegate construction
get<component_type>(*this) = tmp;
using component_predicate = detail::constructible_from<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
component_type tmp(alph); // delegate construction
get<component_type>(*this) = tmp;
}
//!\endcond

Expand Down Expand Up @@ -302,7 +305,10 @@ class alphabet_tuple_base :
//!\endcond
constexpr derived_type & operator=(indirect_component_type const alph) noexcept
{
using component_type = meta::front<meta::find_if<component_list, detail::assignable_from<indirect_component_type>>>;
using component_predicate = detail::assignable_from<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
get<component_type>(*this) = alph; // delegate assignment
return static_cast<derived_type &>(*this);
}
Expand All @@ -315,7 +321,10 @@ class alphabet_tuple_base :
(std::convertible_to<indirect_component_type, component_types> || ...))
constexpr derived_type & operator=(indirect_component_type const alph) noexcept
{
using component_type = meta::front<meta::find_if<component_list, detail::implicitly_convertible_from<indirect_component_type>>>;
using component_predicate = detail::implicitly_convertible_from<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
component_type tmp(alph);
get<component_type>(*this) = tmp;
return static_cast<derived_type &>(*this);
Expand All @@ -329,7 +338,10 @@ class alphabet_tuple_base :
(std::constructible_from<component_types, indirect_component_type> || ...))
constexpr derived_type & operator=(indirect_component_type const alph) noexcept
{
using component_type = meta::front<meta::find_if<component_list, detail::constructible_from<indirect_component_type>>>;
using component_predicate = detail::constructible_from<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
component_type tmp(alph); // delegate construction
get<component_type>(*this) = tmp;
return static_cast<derived_type &>(*this);
Expand All @@ -352,7 +364,7 @@ class alphabet_tuple_base :
{
static_assert(index < sizeof...(component_types), "Index out of range.");

using t = meta::at_c<component_list, index>;
using t = seqan3::list_traits::at<index, component_list>;
t val{};

seqan3::assign_rank_to(l.to_component_rank<index>(), val);
Expand All @@ -372,7 +384,7 @@ class alphabet_tuple_base :
requires is_unique_component<type>
//!\endcond
{
return get<meta::find_index<component_list, type>::value>(l);
return get<seqan3::list_traits::find<type, component_list>>(l);
}

/*!\copybrief get
Expand All @@ -386,7 +398,7 @@ class alphabet_tuple_base :
{
static_assert(index < sizeof...(component_types), "Index out of range.");

using t = meta::at_c<component_list, index>;
using t = seqan3::list_traits::at<index, component_list>;

return seqan3::assign_rank_to(l.to_component_rank<index>(), t{});
}
Expand All @@ -403,7 +415,7 @@ class alphabet_tuple_base :
requires is_unique_component<type>
//!\endcond
{
return get<meta::find_index<component_list, type>::value>(l);
return get<seqan3::list_traits::find<type, component_list>>(l);
}

/*!\brief Implicit cast to a single letter. Works only if the type is unique in the type list.
Expand Down Expand Up @@ -442,7 +454,10 @@ class alphabet_tuple_base :
-> std::enable_if_t<detail::tuple_eq_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
bool>
{
using component_type = meta::front<meta::find_if<component_list, detail::weakly_equality_comparable_with_<indirect_component_type>>>;
using component_predicate = detail::weakly_equality_comparable_with_<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
return get<component_type>(lhs) == rhs;
}

Expand All @@ -461,7 +476,10 @@ class alphabet_tuple_base :
-> std::enable_if_t<detail::tuple_eq_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
bool>
{
using component_type = meta::front<meta::find_if<component_list, detail::weakly_equality_comparable_with_<indirect_component_type>>>;
using component_predicate = detail::weakly_equality_comparable_with_<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
return get<component_type>(lhs) != rhs;
}

Expand All @@ -480,7 +498,10 @@ class alphabet_tuple_base :
-> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
bool>
{
using component_type = meta::front<meta::find_if<component_list, detail::weakly_ordered_with_<indirect_component_type>>>;
using component_predicate = detail::weakly_ordered_with_<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
return get<component_type>(lhs) < rhs;
}

Expand All @@ -499,7 +520,10 @@ class alphabet_tuple_base :
-> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
bool>
{
using component_type = meta::front<meta::find_if<component_list, detail::weakly_ordered_with_<indirect_component_type>>>;
using component_predicate = detail::weakly_ordered_with_<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
return get<component_type>(lhs) <= rhs;
}

Expand All @@ -518,7 +542,10 @@ class alphabet_tuple_base :
-> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
bool>
{
using component_type = meta::front<meta::find_if<component_list, detail::weakly_ordered_with_<indirect_component_type>>>;
using component_predicate = detail::weakly_ordered_with_<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
return get<component_type>(lhs) > rhs;
}

Expand All @@ -537,7 +564,10 @@ class alphabet_tuple_base :
-> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
bool>
{
using component_type = meta::front<meta::find_if<component_list, detail::weakly_ordered_with_<indirect_component_type>>>;
using component_predicate = detail::weakly_ordered_with_<indirect_component_type>;
constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
component_list>;
using component_type = seqan3::list_traits::at<component_position, component_list>;
return get<component_type>(lhs) >= rhs;
}

Expand Down Expand Up @@ -585,9 +615,11 @@ class alphabet_tuple_base :
std::array<rank_type, component_list::size() + 1> ret{};
ret[0] = 1;
size_t count = 1;
meta::for_each(meta::reverse<component_list>{}, [&] (auto alph) constexpr
using reverse_list_t = decltype(seqan3::list_traits::detail::reverse(component_list{}));
seqan3::detail::for_each<reverse_list_t>([&] (auto alphabet_type_identity) constexpr
{
ret[count] = static_cast<rank_type>(seqan3::alphabet_size<decltype(alph)> * ret[count - 1]);
using alphabet_t = typename decltype(alphabet_type_identity)::type;
ret[count] = static_cast<rank_type>(seqan3::alphabet_size<alphabet_t> * ret[count - 1]);
++count;
});

Expand Down Expand Up @@ -778,7 +810,7 @@ template <std::size_t i, seqan3::detail::alphabet_tuple_like tuple_t>
struct tuple_element<i, tuple_t>
{
//!\brief Element type.
using type = meta::at_c<typename tuple_t::seqan3_required_types, i>;
using type = seqan3::list_traits::at<i, typename tuple_t::seqan3_required_types>;
};

/*!\brief Provides access to the number of elements in a tuple as a compile-time constant expression.
Expand Down
Loading

1 comment on commit 9c9e01b

@vercel
Copy link

@vercel vercel bot commented on 9c9e01b May 4, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.