Is Complex?

#include <m3ta/iscomplex>

Checks if a type is the same as std::complex.

Note

Following the behavior of the type traits from the C++ standard library, the check will return false is a std::complex type is passed as a reference.

Functions

m3ta::isComplex
template<typename T>
constexpr bool
isComplex() noexcept
Template Parameters:
 
  • T — Type to check.

Returns

Whether the type is the same as std::complex.

Traits

m3ta::IsComplex
template<typename T>
struct IsComplex
Template Parameters:
 
  • T – Type to check.

Member Types

type

The type std::integral_constant<bool, value> where value is the result of the function m3ta::isComplex().

value_type

The type bool.

Member Constants

static constexpr bool value

Whether the type is the same as std::complex.

Aliases

m3ta::IsComplexT
template<typename T>
using IsComplexT = typename IsComplex<T>::type;

Usage Examples

bool value1 = m3ta::isComplex<float>() // false
bool value2 = m3ta::isComplex<std::complex<float>>() // true
bool value3 = m3ta::isComplex<std::complex<float> &>() // false

using Type1 = m3ta::IsComplexT<float>; // std::integral_constant<bool, false>
using Type2 = m3ta::IsComplexT<std::complex<float>>; // std::integral_constant<bool, true>
using Type3 = m3ta::IsComplexT<std::complex<float> &>; // std::integral_constant<bool, false>