SeqAn3  3.0.0
The Modern C++ library for sequence analysis.
transformation_trait_or.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2019, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
15 #include <type_traits>
16 
17 #include <meta/meta.hpp>
18 
19 #include <seqan3/core/platform.hpp>
20 #include <seqan3/std/type_traits>
21 
22 namespace seqan3::detail
23 {
24 
44 template <typename type_t, typename default_t>
45 using transformation_trait_or = std::conditional_t<meta::is_trait<type_t>::value, // check if type_t::type exists
46  type_t, // if yes, return type_t
47  std::type_identity<default_t>>; // else return default_t as trait
48 
53 template <typename type_t, typename default_t>
54 using transformation_trait_or_t = typename transformation_trait_or<type_t, default_t>::type;
55 
56 } // namespace seqan3::detail
Provides platform and dependency checks.
Definition: aligned_sequence_concept.hpp:35
Provides C++20 additions to the type_traits header.
The identity transformation (a TransformationTrait that returns the input).
Definition: type_traits:30