0

When I read the source code, there are something really confuse me

template<typename T> inline typename NumTraits<T>::Real ei_real(const T& x) { return numext::real(x); }
template<typename T> inline typename NumTraits<T>::Real ei_imag(const T& x) { return numext::imag(x); }
template<typename T> inline T ei_conj(const T& x) { return numext::conj(x); }

and then I read something else in the c++ source code

template<typename _Tp>
inline typename
__gnu_cxx::__enable_if<__is_byte<_Tp>::__value, void>::__type
__fill_a(_Tp* __first, _Tp* __last, const _Tp& __c)
{
  const _Tp __tmp = __c;
  __builtin_memset(__first, static_cast<unsigned char>(__tmp),
           __last - __first);
}

this function use memset to initialze the vector

Now there is 2 questions:
1. why use typename like this typename NumTraits<T>:: what does it mean?
2. explain the typename __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, void>::__type, it's too long to hard to understand.

Any help will be appreciated!

Felix
  • 495
  • 4
  • 9

0 Answers0