SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
Type Traits

Provides various type traits and their shortcuts. More...

+ Collaboration diagram for Type Traits:

Classes

struct  seqan3::detail::deferred_type< t, dependent_ts >
 Return the type identity; further arguments are ignored, but can make this type dependent if they are. More...
 
struct  seqan3::function_traits< std::function< return_t(args_t...)> >
 A traits class to provide a uniform interface to the properties of a function type. More...
 
struct  seqan3::detail::instantiate< t >
 A transformation trait that instantiates seqan3::lazy types. Base template is the identity transformation. More...
 
struct  seqan3::detail::instantiate< lazy< template_t, spec_t... > >
 A transformation trait that instantiates seqan3::lazy types. More...
 
struct  seqan3::detail::instantiate_if< t, condition >
 A transformation trait that instantiates seqan3::lazy types given a boolean condition. Base template is std::false_type. More...
 
struct  seqan3::detail::instantiate_if< lazy< template_t, spec_t... >, true >
 A transformation trait that instantiates seqan3::lazy types given a boolean condition. If condition is true and parameter is lazy, the instantiated type. More...
 
struct  seqan3::detail::instantiate_if< t, true >
 A transformation trait that instantiates seqan3::lazy types given a boolean condition. If condition is true and parameter is not lazy, the type identity. More...
 
struct  seqan3::is_constexpr_default_constructible< t >
 Whether a type std::is_default_constructible in constexpr-context (unary_type_trait specialisation). More...
 
struct  seqan3::detail::lazy< template_t, spec_t >
 An empty type whose only purpose is to hold an uninstantiated template plus its arguments. More...
 
struct  seqan3::detail::lazy_conditional< decision, on_true_t, on_false_t >
 Behaves like std::conditional, but instantiates types wrapped in seqan3::lazy. More...
 
struct  seqan3::remove_rvalue_reference< t >
 Return the input type with && removed, but lvalue references preserved. More...
 
interface  transformation_trait
 Concept for a transformation trait. More...
 
interface  unary_type_trait
 Concept for a unary traits type. More...
 

Macros

#define SEQAN3_IS_CONSTEXPR(...)   std::integral_constant<bool, __builtin_constant_p(((void)__VA_ARGS__, 0))>::value
 Returns true if the expression passed to this macro can be evaluated at compile time, false otherwise.
 
#define SEQAN3_IS_SAME(...)   std::is_same_v<__VA_ARGS__>
 A macro that behaves like std::is_same_v, except that it doesn't need to instantiate the template on GCC and Clang.
 

Typedefs

template<typename t , typename... dependent_ts>
using seqan3::detail::deferred_type_t = typename deferred_type< t, dependent_ts... >::type
 Return the type identity; further arguments are ignored, but can make this type dependent if they are (transformation_trait shortcut).
 
using seqan3::detail::ignore_t = std::remove_cvref_t< decltype(std::ignore)>
 Return the type of std::ignore with const, volatile and references removed (type trait).
 
template<typename type_t , typename default_t >
using seqan3::detail::transformation_trait_or = std::conditional_t< transformation_trait< type_t >, type_t, std::type_identity< default_t > >
 This gives a fallback type if type_t::type is not defined.
 
template<typename type_t , typename default_t >
using seqan3::detail::transformation_trait_or_t = typename transformation_trait_or< type_t, default_t >::type
 Helper type of seqan3::detail::transformation_trait_or (transformation_trait shortcut).
 

Variables

template<typename t >
constexpr bool seqan3::detail::decays_to_ignore_v = std::is_same_v<std::remove_cvref_t<t>, ignore_t>
 Return whether the input type with const, volatile and references removed is std::ignore's type. (type trait).
 

Detailed Description

Provides various type traits and their shortcuts.

See also
Utility

Macro Definition Documentation

◆ SEQAN3_IS_CONSTEXPR

#define SEQAN3_IS_CONSTEXPR (   ...)    std::integral_constant<bool, __builtin_constant_p(((void)__VA_ARGS__, 0))>::value

Returns true if the expression passed to this macro can be evaluated at compile time, false otherwise.

Returns
true or false.

Typedef Documentation

◆ deferred_type_t

template<typename t , typename... dependent_ts>
using seqan3::detail::deferred_type_t = typedef typename deferred_type<t, dependent_ts...>::type

Return the type identity; further arguments are ignored, but can make this type dependent if they are (transformation_trait shortcut).

Template Parameters
tThe type to operate on.
dependent_tsAny provided types are ignored.
See also
seqan3::detail::deferred_type

◆ transformation_trait_or

template<typename type_t , typename default_t >
using seqan3::detail::transformation_trait_or = typedef std::conditional_t<transformation_trait<type_t>, type_t, std::type_identity<default_t> >

This gives a fallback type if type_t::type is not defined.

Template Parameters
type_tThe type to use if type_t::type is defined.
default_tThe type to use otherwise.
See also
seqan3::detail::transformation_trait_or_t

Gives type_t back if T::type is a member type, otherwise struct{using type = default_t}.

// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
template <typename T>
struct A;
template <>
struct A<int>
{
using type = int;
};
// A<unsigned>::type is not defined, thus falling back to `void`
static_assert(std::is_same_v<void, seqan3::detail::transformation_trait_or_t<A<unsigned>, void>>);
// A<int>::type is defined, use A<int>::type
static_assert(std::is_same_v<int, seqan3::detail::transformation_trait_or_t<A<int>, void>>);
Provides seqan3::detail::transformation_trait_or.
Attention
This might get removed if one of our used libraries offers the same functionality.

Helper types

seqan3::detail::transformation_trait_or_t as a shorthand for seqan3::detail::transformation_trait_or::type

◆ transformation_trait_or_t

template<typename type_t , typename default_t >
using seqan3::detail::transformation_trait_or_t = typedef typename transformation_trait_or<type_t, default_t>::type

Variable Documentation

◆ decays_to_ignore_v

template<typename t >
constexpr bool seqan3::detail::decays_to_ignore_v = std::is_same_v<std::remove_cvref_t<t>, ignore_t>
constexpr

Return whether the input type with const, volatile and references removed is std::ignore's type. (type trait).

Template Parameters
tThe type to operate on.
Hide me