gslcpp
Modern-C++ Wrapper for GSL
is-complex.hpp
Go to the documentation of this file.
1 /// \file include/gslcpp/wrap/is-complex.hpp
2 /// \copyright 2022 Thomas E. Vaughan, all rights reserved.
3 /// \brief Definition of gsl::is_complex, gsl::is_complex_v.
4 
5 #pragma once
6 #include "complex.hpp"
7 
8 namespace gsl {
9 
10 
11 /// Define is_complex::VALUE as false for generic is_complex.
12 /// Specialization for each complex `T` defines value as true.
13 /// \tparam T Candidate type for determination of complexity.
14 template<typename T> struct is_complex {
15  enum : bool { VALUE= false /**< Indicate that `T` is not complex. */ };
16 };
17 
18 
19 /// Specialization that defines is_complex::VALUE as true.
20 /// Generic is_complex defines value as false.
21 /// \tparam U Type of each element of complex value.
22 template<typename U> struct is_complex<gsl::complex<U>> {
23  enum : bool { VALUE= true /**< Indicate that `T` is complex. */ };
24 };
25 
26 
27 /// Specialization that defines is_complex::VALUE as true.
28 /// Generic is_complex defines value as false.
29 /// \tparam U Type of each element of complex (constant) value.
30 template<typename U> struct is_complex<gsl::complex<U> const> {
31  enum : bool { VALUE= true /**< Indicate that `T` is complex. */ };
32 };
33 
34 
35 /// True if `T` be type of complex element in vector or matrix.
36 /// \tparam T Candidate type of element in vector or matrix.
37 template<typename T> constexpr bool is_complex_v= is_complex<T>::VALUE;
38 
39 
40 } // namespace gsl
41 
42 // EOF
gsl::is_complex< gsl::complex< U > const >::VALUE
@ VALUE
Indicate that T is complex.
Definition: is-complex.hpp:31
gsl::is_complex::VALUE
@ VALUE
Indicate that T is not complex.
Definition: is-complex.hpp:15
gsl::is_complex_v
constexpr bool is_complex_v
True if T be type of complex element in vector or matrix.
Definition: is-complex.hpp:37
gsl::is_complex< gsl::complex< U > >::VALUE
@ VALUE
Indicate that T is complex.
Definition: is-complex.hpp:23
gsl::is_complex
Define is_complex::VALUE as false for generic is_complex.
Definition: is-complex.hpp:14
gsl
Namespace for C++-interface to GSL.
Definition: v-iface.hpp:51