SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
Core

Provides core functionality used by multiple modules. More...

+ Collaboration diagram for Core:

Modules

 Algorithm
 Provides core functionality used to configure algorithms.
 
 builtin_character operations
 Provides various operations on character types.
 
 Concept
 Additional concepts that are not specific to a SeqAn module.
 
 Parallel
 This module contains types and utilities for concurrent execution of algorithms in SeqAn.
 
 Type List
 Provides seqan3::type_list and metaprogramming utilities for working on type lists and type packs.
 
 Type Traits
 Provides various type traits and their shortcuts.
 

Classes

interface  cereal_archive
 All archives of the Cereal library satisfy this. More...
 
interface  cereal_input_archive
 All input archives of the Cereal library satisfy this. More...
 
interface  cereal_output_archive
 All output archives of the Cereal library satisfy this. More...
 
interface  cereal_text_archive
 All text archives of the Cereal library satisfy this. More...
 
interface  cerealisable
 Specifies the requirements for types that are serialisable via Cereal. More...
 
class  seqan3::debug_stream_type< char_t >
 A "pretty printer" for most SeqAn data structures and related types. More...
 
interface  pair_like
 Whether a type behaves like a tuple with exactly two elements. More...
 
struct  seqan3::pod_tuple< type0 >
 Recursion anchor for pod_tuple. More...
 
struct  seqan3::pod_tuple< type0, types... >
 Behaves like std::tuple but is an aggregate PODType. More...
 
interface  tuple_like
 Whether a type behaves like a tuple. More...
 

Macros

#define SEQAN3_WITH_CEREAL   0
 Whether CEREAL support is available or not.
 
#define SEQAN3_WITH_LEMON   0
 Whether Lemon support is available or not.
 

Functions

template<typename base_t , std::unsigned_integral exp_t>
base_t seqan3::pow (base_t base, exp_t exp)
 Computes the value of base raised to the power exp. More...
 

Variables

template<typename t >
constexpr bool seqan3::add_enum_bitwise_operators = false
 Set to true for a scoped enum to have binary operators overloaded. More...
 

Tuple utility functions

Helper functions for tuple like objects.

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

Detailed Description

Provides core functionality used by multiple modules.

The core module contains concepts, functions and some classes that are used by multiple other modules, but that usually are not relevant to most users of the library.

Function Documentation

◆ pow()

template<typename base_t , std::unsigned_integral exp_t>
base_t seqan3::pow ( base_t  base,
exp_t  exp 
)

Computes the value of base raised to the power exp.

Parameters
[in]baseThe base to compute the power for.
[in]expThe power to raise base to.
Returns
$ base^{exp} $.
Exceptions
std::overflow_errorif an overflow occurs (Only in Debug build).
std::underflow_errorif an underflow occurs (Only in Debug build).
See also
https://en.cppreference.com/w/cpp/numeric/math/pow

The difference to std::pow is that the powers of an integer base are computed exact (without precision loss due to promoting to double) iff exp_t models std::unsigned_integral and

In all other cases the return value and type is equivalent to that of std::pow.

Example

int main()
{
// Uses specialisation for signed integers.
seqan3::debug_stream << seqan3::pow(2, 3u) << '\n'; // Prints 8
seqan3::debug_stream << seqan3::pow(-2, 3u) << '\n'; // Prints -8
// Uses specialisation for unsigned integers.
seqan3::debug_stream << seqan3::pow(2u, 3u) << '\n'; // Prints 8
// Uses `std::pow`.
seqan3::debug_stream << seqan3::pow(2, 3) << '\n'; // Prints 8
seqan3::debug_stream << seqan3::pow(2u, 3) << '\n'; // Prints 8
seqan3::debug_stream << seqan3::pow(2.0, 3) << '\n'; // Prints 8
// 5^25 should be 298023223876953125.
seqan3::debug_stream << seqan3::pow(5u, 25u) << '\n'; // Prints 298023223876953125
seqan3::debug_stream << static_cast<uint64_t>(std::pow(5u, 25u)) << '\n'; // Prints 298023223876953152 (wrong!)
}

◆ tuple_pop_front()

template<tuple_like tuple_t>
constexpr auto seqan3::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 seqan3::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

int main()
{
// Split at position 2.
auto [left, right] = seqan3::tuple_split<2>(t);
// decltype(left) -> std::tuple<int, char>; decltype(right) -> std::tuple<float, std::string>;
// Split at position 0.
auto [left1, right1] = seqan3::tuple_split<0>(t);
// decltype(left1) -> std::tuple<>; decltype(right1) -> std::tuple<int, char, float, std::string>;
// Split at position 4.
auto [left2, right2] = seqan3::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() [2/3]

template<size_t pivot_c, template< typename ... > typename tuple_t, typename ... ts>
constexpr auto seqan3::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

int main()
{
// Split at position 2.
auto [left, right] = seqan3::tuple_split<2>(t);
// decltype(left) -> std::tuple<int, char>; decltype(right) -> std::tuple<float, std::string>;
// Split at position 0.
auto [left1, right1] = seqan3::tuple_split<0>(t);
// decltype(left1) -> std::tuple<>; decltype(right1) -> std::tuple<int, char, float, std::string>;
// Split at position 4.
auto [left2, right2] = seqan3::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>
constexpr auto seqan3::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

int main()
{
// Split at position 2.
auto [left, right] = seqan3::tuple_split<2>(t);
// decltype(left) -> std::tuple<int, char>; decltype(right) -> std::tuple<float, std::string>;
// Split at position 0.
auto [left1, right1] = seqan3::tuple_split<0>(t);
// decltype(left1) -> std::tuple<>; decltype(right1) -> std::tuple<int, char, float, std::string>;
// Split at position 4.
auto [left2, right2] = seqan3::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.

Variable Documentation

◆ add_enum_bitwise_operators

template<typename t >
constexpr bool seqan3::add_enum_bitwise_operators = false
constexpr

Set to true for a scoped enum to have binary operators overloaded.

If this type trait is specialised for an enum, the binary operators &, |, ^, ~, &=, |=, ^= will be added and behave just like for ints or unscoped enums.

Example

enum class my_enum
{
VAL1 = 1,
VAL2 = 2,
COMB = 3
};
template <>
constexpr bool seqan3::add_enum_bitwise_operators<my_enum> = true;
int main()
{
using seqan3::operator|;
my_enum e = my_enum::VAL1;
my_enum e2 = e | my_enum::VAL2;
// e2 == my_enum::COMB;
}
debug_stream.hpp
Provides seqan3::debug_stream and related types.
seqan3::pow
base_t pow(base_t base, exp_t exp)
Computes the value of base raised to the power exp.
Definition: math.hpp:49
std::tuple
tuple_utility.hpp
Provides utility functions for tuple like interfaces.
add_enum_bitwise_operators.hpp
Provides seqan3::add_enum_bitwise_operators.
std::left
T left(T... args)
seqan3::debug_stream
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition: debug_stream.hpp:42
math.hpp
Provides math related functionality.
std::pow
T pow(T... args)