AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
OptionalNoCopy.hpp
1#pragma once
2
3#include <optional>
4
5namespace AMDiS {
6
8template <class T>
10 : public std::optional<T>
11{
12 using Self = OptionalNoCopy;
13 using Super = std::optional<T>;
14
15public:
16 using Super::Super;
17
20 : Super(std::nullopt)
21 {}
22
25 : Super(std::nullopt)
26 {}
27
30 {
31 return *this;
32 }
33
36 {
37 return *this;
38 }
39};
40
41} // end namespace AMDiS
Modification of std::optional that does not copy or move its content.
Definition: OptionalNoCopy.hpp:11
OptionalNoCopy(Self &&)
Move constructor discards the stored optional value.
Definition: OptionalNoCopy.hpp:24
OptionalNoCopy(Self const &)
Copy constructor discards the stored optional value.
Definition: OptionalNoCopy.hpp:19
Self & operator=(Self const &)
Copy assignment does nothing.
Definition: OptionalNoCopy.hpp:29
Self & operator=(Self &&)
Move assignment does nothing.
Definition: OptionalNoCopy.hpp:35