/////////////////////////////////////////////////////////////////////////////// /// \file complex.hpp /// // Copyright 2005 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_NUMERIC_FUNCTIONAL_COMPLEX_HPP_EAN_01_17_2006 #define BOOST_NUMERIC_FUNCTIONAL_COMPLEX_HPP_EAN_01_17_2006 #ifdef BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED # error Include this file before boost/accumulators/numeric/functional.hpp #endif #include #include #include #include #include #include namespace boost { namespace numeric { namespace operators { // So that the stats compile when Sample type is std::complex template typename disable_if< mpl::or_, is_same, U> > , std::complex >::type operator *(std::complex ri, U const &u) { // BUGBUG promote result to typeof(T()*u) ? return ri *= static_cast(u); } template typename disable_if< mpl::or_, is_same, U> > , std::complex >::type operator /(std::complex ri, U const &u) { // BUGBUG promote result to typeof(T()*u) ? return ri /= static_cast(u); } }}} // namespace boost::numeric::operators namespace boost { namespace numeric { namespace detail { template struct one_complex { static std::complex const value; }; template std::complex const one_complex::value = std::complex(numeric::one::value, numeric::one::value); } /// INTERNAL ONLY /// template struct one > : detail::one_complex { typedef one type; typedef std::complex value_type; operator value_type const & () const { return detail::one_complex::value; } }; }} // namespace boost::numeric #endif