TRIQS/h5 2.0.0
C++ interface to HDF5
Loading...
Searching...
No Matches
complex.hpp
Go to the documentation of this file.
1// Copyright (c) 2024 Simons Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0.txt
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Authors: Thomas Hahn, Olivier Parcollet, Nils Wentzell
16
21
22#ifndef LIBH5_COMPLEX_HPP
23#define LIBH5_COMPLEX_HPP
24
25#include <complex>
26#include <type_traits>
27
28namespace h5 {
29
39 struct dcplx_t {
41 double r;
42
44 double i;
45 };
46
47 namespace detail {
48
49 // Type trait to check if a type is `std::complex`.
50 template <typename T>
51 struct _is_complex : std::false_type {};
52
53 // Specialization of h5::_is_complex for `std::complex`.
54 template <typename T>
55 struct _is_complex<std::complex<T>> : std::true_type {};
56
57 } // namespace detail
58
64 template <typename T>
65 constexpr bool is_complex_v = detail::_is_complex<T>::value;
66
67} // namespace h5
68
69#endif // LIBH5_COMPLEX_HPP
constexpr bool is_complex_v
Boolean type trait set to true for std::complex types.
Definition complex.hpp:65
A complex compound type consisting of two doubles to represent a complex number.
Definition complex.hpp:39
double r
Real part.
Definition complex.hpp:41
double i
Imaginary part.
Definition complex.hpp:44