
Dear all, Can someone add an is_complex<T>::value trait to type_traits.hpp ::boost::is_complex<T>::value trait to type_traits.hpp I have found myself having to do this frequently. It strikes me that for templated scientific codes it is a common requirement. Below is my implementation, please feel free to add it. I should probably inform the maintainer as well, John Maddock but there is no obvious way of contacting him via the boost site. namespace boost { /** * @brief Default trait for determining if a type is complex at * compile-time. * * If the supplied template parameter type is not a std::complex<> * then this struct is instantiated and the ::value enum will be 0 * at compile time. * * See also boost::is_float and associated in * boost/type_traits.hpp */ template <typename T> struct is_complex : ::boost::mpl::false_{}; /** * @brief Overloaded trait for std::complex<> to determine if a * type is complex at compile-time. * * If the supplied type is std::complex<double> or similar this * overloaded struct is instantiated and the ::value enum will be * 1 at compile-time. * * See also boost::is_float and associated in * boost/type_traits.hpp */ template <typename T> struct is_complex<std::complex<T> > : ::boost::mpl::true_{}; } -ed -- Dr. Edward Grace Photonics Group, Physics Department Blackett Laboratory Imperial College SW7 2BW t: 020 759 47719 e: ej.grace@imperial.ac.uk w: http://ptweb.op.ph.ic.ac.uk/~graceej

Can someone add an is_complex<T>::value trait to type_traits.hpp
Sounds reasonable to me.
I have found myself having to do this frequently. It strikes me that for templated scientific codes it is a common requirement.
Below is my implementation, please feel free to add it. I should probably inform the maintainer as well, John Maddock but there is no obvious way of contacting him via the boost site.
You've just found a way :-) John.
participants (2)
-
Edward Grace
-
John Maddock