00001 /* 00002 * 00003 * Copyright (c) Kresimir Fresl and Toon Knapen 2002, 2003 00004 * 00005 * Distributed under the Boost Software License, Version 1.0. 00006 * (See accompanying file LICENSE_1_0.txt or copy at 00007 * http://www.boost.org/LICENSE_1_0.txt) 00008 * 00009 * First author acknowledges the support of the Faculty of Civil Engineering, 00010 * University of Zagreb, Croatia. 00011 * 00012 */ 00013 00014 #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_TRAITS_HPP 00015 #define BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_TRAITS_HPP 00016 00017 #include <boost/numeric/bindings/traits/config.hpp> 00018 #include <boost/numeric/bindings/traits/type.h> 00019 #include <boost/numeric/bindings/traits/type.hpp> 00020 00021 namespace boost { namespace numeric { namespace bindings { namespace traits { 00022 00023 template <typename Real> 00024 struct type_traits { 00025 #ifdef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 00026 typedef Real type; 00027 typedef Real real_type; 00028 #endif 00029 }; 00030 template<> 00031 struct type_traits<float> { 00032 typedef float type; 00033 typedef float real_type; 00034 }; 00035 template<> 00036 struct type_traits<double> { 00037 typedef double type; 00038 typedef double real_type; 00039 }; 00040 template<> 00041 struct type_traits<complex_f> { 00042 typedef complex_f type; 00043 typedef float real_type; 00044 }; 00045 template<> 00046 struct type_traits<complex_d> { 00047 typedef complex_d type; 00048 typedef double real_type; 00049 }; 00050 00051 00052 inline const fcomplex_t* complex_ptr(const complex_f* c) { return reinterpret_cast<const fcomplex_t*>( c ) ; } 00053 inline const dcomplex_t* complex_ptr(const complex_d* c) { return reinterpret_cast<const dcomplex_t*>( c ) ; } 00054 00055 inline fcomplex_t* complex_ptr( complex_f* c) { return reinterpret_cast< fcomplex_t*>( c ) ; } 00056 inline dcomplex_t* complex_ptr( complex_d* c) { return reinterpret_cast< dcomplex_t*>( c ) ; } 00057 00058 }}}} 00059 00060 #endif // BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_TRAITS_HPP 00061