Why do gcc's std::real() and std::imag() return references?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I have noticed that gcc's std::real() and std::imag() return a reference, unless 
"-std=c++0x" is specified. The C++98 standard specifies in section 26.2.7 that 
these two functions have the following prototypes:

template<class T> T real(const complex<T>&);
template<class T> T imag(const complex<T>&);

In gcc 4.4, for example, it is:
template<typename _Tp> _Tp& real(complex<_Tp>& __z)

Is there a reason for this deviation from the standard? This breaks for any 
specializations of std::complex that return a value for real() and imag().

Thanks,
- Rudy



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux