1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
#ifndef HPC_AUX_ISCOMPLEX_H
#define HPC_AUX_ISCOMPLEX_H 1

#include <complex>
#include <type_traits>

namespace hpc { namespace aux {

template <typename Any>
struct IsComplex
{
    struct Two {
        char a, b;
    };

    template <typename T>
        static char
        checker(const std::complex<T> &);

    template <typename T>
        static Two
        checker(const T &);

    static Any        any;
    static const bool value = sizeof(checker(any)) == 1;
};



} } // namespace aux, hpc

#endif // HPC_AUX_ISCOMPLEX_H