SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
non_propagating_cache.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
9
10
#pragma once
11
12
#include <
optional
>
13
14
#include <
seqan3/core/platform.hpp
>
15
16
namespace
seqan3::detail
17
{
18
32
template
<
typename
T>
33
requires
std::is_object_v<T>
34
class
non_propagating_cache :
public
std::optional<T>
35
{
36
public
:
38
using
std::optional<T>
::optional
;
40
using
std::optional<T>::operator=;
41
43
constexpr
non_propagating_cache(non_propagating_cache
const
&)
noexcept
44
{}
45
47
constexpr
non_propagating_cache(non_propagating_cache && other)
noexcept
48
{
49
other.reset();
50
}
51
53
constexpr
non_propagating_cache & operator=(non_propagating_cache
const
& other)
noexcept
54
{
55
if
(
std::addressof
(other) !=
this
)
56
this->
reset
();
57
return
*
this
;
58
}
59
61
constexpr
non_propagating_cache & operator=(non_propagating_cache && other)
noexcept
62
{
63
this->
reset
();
64
other.reset();
65
return
*
this
;
66
}
67
69
template
<
class
I>
70
constexpr
T & emplace_deref(I
const
& i)
71
requires
requires
(I
const
& i) { T(*i); }
72
{
73
this->
reset
();
74
this->
emplace
(*i);
75
return
this->
value
();
76
}
77
};
78
79
}
// namespace seqan3::detail
std::addressof
T addressof(T... args)
std::optional< T >::emplace
T emplace(T... args)
std::is_object_v
T is_object_v
optional
platform.hpp
Provides platform and dependency checks.
std::optional< T >::reset
T reset(T... args)
std::optional< T >::value
T value(T... args)
Hide me
Version:
seqan3
utility
views
detail
non_propagating_cache.hpp
Generated on
for SeqAn3 by
1.17.0