BioC++ core-0.7.0
The Modern C++ libraries for Bioinformatics.
 
Loading...
Searching...
No Matches
Meta

Provides metaprogramming utilities, concepts and some helper classes. More...

+ Collaboration diagram for Meta:

Modules

 Concept
 Additional concepts that are not specific to a BioC++ module.
 
 Tag
 Provides tagging utilities (often used in tag-dispatching).
 
 Type List
 Provides bio::meta::type_list and metaprogramming utilities for working on type lists.
 
 Type Traits
 Provides various type traits and their shortcuts.
 

Namespaces

namespace  bio::meta
 The Meta module's namespace.
 
namespace  bio::meta::literals
 An inline namespace for meta literals. It exists to safely allow using namespace.
 

Classes

struct  bio::meta::overloaded< functors >
 Wrapper to create an overload set of multiple functors. More...
 
struct  bio::meta::pod_tuple< type0 >
 Recursion anchor for pod_tuple. More...
 
struct  bio::meta::pod_tuple< type0, types... >
 Behaves like std::tuple but is an aggregate PODType. More...
 

Functions

template<typename... functors>
 overloaded (functors...) -> overloaded< functors... >
 Deduction guide for bio::meta::overloaded.
 

Tuple utility functions

Helper functions for tuple like objects.

template<size_t pivot_c, template< typename... > typename tuple_t, typename... ts>
requires tuple_like<tuple_t<ts...>>
constexpr auto bio::meta::tuple_split (tuple_t< ts... > const &t)
 Splits a tuple like data structure at the given position.
 
template<typename pivot_t , tuple_like tuple_t>
constexpr auto bio::meta::tuple_split (tuple_t &&t)
 Splits a tuple like data structure at the first position of the given type.
 
template<tuple_like tuple_t>
constexpr auto bio::meta::tuple_pop_front (tuple_t &&t)
 Removes the first element of a tuple.
 
template<size_t pivot_c, template< typename... > typename tuple_t, typename... ts>
requires tuple_like<tuple_t<ts...>>
constexpr auto bio::meta::tuple_split (tuple_t< ts... > &&t)
 Splits a tuple like data structure at the given position.
 

Detailed Description

Provides metaprogramming utilities, concepts and some helper classes.

The meta module is used strongly by other modules, but the content is usually not relevant to most users of the library.

Function Documentation

◆ tuple_pop_front()

template<tuple_like tuple_t>
constexpr auto bio::meta::tuple_pop_front ( tuple_t &&  t)
constexpr

Removes the first element of a tuple.

Parameters
[in]tThe original tuple.
Returns
A new tuple without the first element of t.

Note, that the tuple must contain at least one element and must support empty tuple types, i.e. std::pair cannot be used.

Complexity

Linear in the number of elements.

Thread safety

Concurrent invocations of this functions are thread safe.

◆ tuple_split() [1/3]

template<typename pivot_t , tuple_like tuple_t>
constexpr auto bio::meta::tuple_split ( tuple_t &&  t)
constexpr

Splits a tuple like data structure at the first position of the given type.

Template Parameters
pivot_tA template type specifying the split position.
Parameters
[in]tThe original tuple to split.
Returns
A new tuple of tuples with the left side of the split and the right side of the split.

Splits a tuple into two tuples, while the element at the split position will be contained in the second tuple. Note, that the returned tuples can be empty. For this reason it is not possible to use tuple like objects, that cannot be empty, i.e. std::pair. Using such an object will emit an compiler error.

example

#include <string>
int main()
{
// Split at position 2.
auto [left, right] = bio::meta::tuple_split<2>(t);
// decltype(left) -> std::tuple<int, char>; decltype(right) -> std::tuple<float, std::string>;
// Split at position 0.
auto [left1, right1] = bio::meta::tuple_split<0>(t);
// decltype(left1) -> std::tuple<>; decltype(right1) -> std::tuple<int, char, float, std::string>;
// Split at position 4.
auto [left2, right2] = bio::meta::tuple_split<4>(t);
// decltype(left2) -> std::tuple<int, char, float, std::string>; decltype(right2) -> std::tuple<>;
}
Provides utility functions for tuple like interfaces.

Complexity

Linear in the number of elements.

Thread safety

Concurrent invocations of this functions are thread safe.

◆ tuple_split() [2/3]

template<size_t pivot_c, template< typename... > typename tuple_t, typename... ts>
requires tuple_like<tuple_t<ts...>>
constexpr auto bio::meta::tuple_split ( tuple_t< ts... > &&  t)
constexpr

Splits a tuple like data structure at the given position.

Template Parameters
pivot_cA template value specifying the split position.
tuple_tA template alias for a tuple like object.
...tsTypes tuple_t is specified with.
Parameters
[in]tThe original tuple to split.
Returns
A new tuple of tuples with the left side of the split and the right side of the split.

Splits a tuple into two tuples, while the element at the split position will be contained in the second tuple. Note, that the returned tuples can be empty. For this reason it is not possible to use tuple like objects, that cannot be empty, i.e. std::pair. Using such an object will emit an compiler error.

example

#include <string>
int main()
{
// Split at position 2.
auto [left, right] = bio::meta::tuple_split<2>(t);
// decltype(left) -> std::tuple<int, char>; decltype(right) -> std::tuple<float, std::string>;
// Split at position 0.
auto [left1, right1] = bio::meta::tuple_split<0>(t);
// decltype(left1) -> std::tuple<>; decltype(right1) -> std::tuple<int, char, float, std::string>;
// Split at position 4.
auto [left2, right2] = bio::meta::tuple_split<4>(t);
// decltype(left2) -> std::tuple<int, char, float, std::string>; decltype(right2) -> std::tuple<>;
}

Complexity

Linear in the number of elements.

Thread safety

Concurrent invocations of this functions are thread safe.

◆ tuple_split() [3/3]

template<size_t pivot_c, template< typename... > typename tuple_t, typename... ts>
requires tuple_like<tuple_t<ts...>>
constexpr auto bio::meta::tuple_split ( tuple_t< ts... > const &  t)
constexpr

Splits a tuple like data structure at the given position.

Template Parameters
pivot_cA template value specifying the split position.
tuple_tA template alias for a tuple like object.
...tsTypes tuple_t is specified with.
Parameters
[in]tThe original tuple to split.
Returns
A new tuple of tuples with the left side of the split and the right side of the split.

Splits a tuple into two tuples, while the element at the split position will be contained in the second tuple. Note, that the returned tuples can be empty. For this reason it is not possible to use tuple like objects, that cannot be empty, i.e. std::pair. Using such an object will emit an compiler error.

example

#include <string>
int main()
{
// Split at position 2.
auto [left, right] = bio::meta::tuple_split<2>(t);
// decltype(left) -> std::tuple<int, char>; decltype(right) -> std::tuple<float, std::string>;
// Split at position 0.
auto [left1, right1] = bio::meta::tuple_split<0>(t);
// decltype(left1) -> std::tuple<>; decltype(right1) -> std::tuple<int, char, float, std::string>;
// Split at position 4.
auto [left2, right2] = bio::meta::tuple_split<4>(t);
// decltype(left2) -> std::tuple<int, char, float, std::string>; decltype(right2) -> std::tuple<>;
}

Complexity

Linear in the number of elements.

Thread safety

Concurrent invocations of this functions are thread safe.