# tr1/complex

Go to the documentation of this file.

    00001 // TR1 complex -*- C++ -*-
    00002
    00003 // Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    00004 //
    00005 // This file is part of the GNU ISO C++ Library.  This library is free
    00006 // software; you can redistribute it and/or modify it under the
    00007 // terms of the GNU General Public License as published by the
    00008 // Free Software Foundation; either version 3, or (at your option)
    00009 // any later version.
    00010
    00011 // This library is distributed in the hope that it will be useful,
    00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00014 // GNU General Public License for more details.
    00015
    00016 // Under Section 7 of GPL version 3, you are granted additional
    00017 // permissions described in the GCC Runtime Library Exception, version
    00018 // 3.1, as published by the Free Software Foundation.
    00019
    00020 // You should have received a copy of the GNU General Public License and
    00021 // a copy of the GCC Runtime Library Exception along with this program;
    00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    00023 // <http://www.gnu.org/licenses/>.
    00024
    00025 /** @file tr1/complex
    00026  *  This is a TR1 C++ Library header.
    00027  */
    00028
    00029 #ifndef _GLIBCXX_TR1_COMPLEX
    00030 #define _GLIBCXX_TR1_COMPLEX 1
    00031
    00032 #pragma GCC system_header
    00033
    00034 #if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
    00035 #  error TR1 header cannot be included from C++0x header
    00036 #endif
    00037
    00038 #include <complex>
    00039
    00040 #if defined(_GLIBCXX_INCLUDE_AS_TR1)
    00041 #  include <tr1_impl/complex>
    00042 #else
    00043 #  define _GLIBCXX_INCLUDE_AS_TR1
    00044 #  define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
    00045 #  define _GLIBCXX_END_NAMESPACE_TR1 }
    00046 #  define _GLIBCXX_TR1 tr1::
    00047 #  include <tr1_impl/complex>
    00048 #  undef _GLIBCXX_TR1
    00049 #  undef _GLIBCXX_END_NAMESPACE_TR1
    00050 #  undef _GLIBCXX_BEGIN_NAMESPACE_TR1
    00051 #  undef _GLIBCXX_INCLUDE_AS_TR1
    00052 #endif
    00053
    00054 namespace std
    00055 {
    00056 namespace tr1
    00057 {
    00058   using std::arg;
    00059
    00060   template<typename _Tp>
    00061     inline std::complex<_Tp>
    00062     conj(const std::complex<_Tp>& __z)
    00063     { return std::conj(__z); }
    00064
    00065   template<typename _Tp>
    00066     inline std::complex<typename __gnu_cxx::__promote<_Tp>::__type>
    00067     conj(_Tp __x)
    00068     { return __x; }
    00069
    00070   using std::imag;
    00071   using std::norm;
    00072   using std::polar;
    00073
    00074   template<typename _Tp, typename _Up>
    00075     inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
    00076     polar(const _Tp& __rho, const _Up& __theta)
    00077     {
    00078       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
    00079       return std::polar(__type(__rho), __type(__theta));
    00080     }
    00081
    00082   using std::real;
    00083
    00084   template<typename _Tp>
    00085     inline std::complex<_Tp>
    00086     pow(const std::complex<_Tp>& __x, const _Tp& __y)
    00087     { return std::pow(__x, __y); }
    00088
    00089   template<typename _Tp>
    00090     inline std::complex<_Tp>
    00091     pow(const _Tp& __x, const std::complex<_Tp>& __y)
    00092     { return std::pow(__x, __y); }
    00093
    00094   template<typename _Tp>
    00095     inline std::complex<_Tp>
    00096     pow(const std::complex<_Tp>& __x, const std::complex<_Tp>& __y)
    00097     { return std::pow(__x, __y); }
    00098 }
    00099 }
    00100
    00101 #endif // _GLIBCXX_TR1_COMPLEX