On 11/22/07, Tsai Dung-Bang <dbtsai@gmail.com> wrote:
In the typedef real_value_type, how could I do this?

if( value_type  is complex)
   typedef  typename  value_type::value_type real_value_type;
else
  typedef value_type real_value_type


I would use template specialization instead of typeid, like this (NOTE: didn't check for syntax errors):

template<class T> struct real_type {
    typedef T value_type;
};

template<class T> struct real_type<complex<T> > {
    typedef typename complex<T>::value_type value_type;
};

template<typename MATRIX> MATRIX expm_pad(const MATRIX &H, const int p = 6)

{
    typedef typename MATRIX::value_type value_type;
    typedef typename MATRIX::size_type size_type;
    typedef typename real_type<value_type>::value_type real_value_type;
    ....
}



Daniele