Implement literal suffixes for compled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192048 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1521,6 +1521,47 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
|
||||
return __os << __s.str();
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
// Literal suffix for complex number literals [complex.literals]
|
||||
inline namespace literals
|
||||
{
|
||||
inline namespace complex_literals
|
||||
{
|
||||
constexpr complex<long double> operator""il(long double __im)
|
||||
{
|
||||
return { 0.0l, __im };
|
||||
}
|
||||
|
||||
constexpr complex<long double> operator""il(unsigned long long __im)
|
||||
{
|
||||
return { 0.0l, static_cast<long double>(__im) };
|
||||
}
|
||||
|
||||
|
||||
constexpr complex<double> operator""i(long double __im)
|
||||
{
|
||||
return { 0.0, static_cast<double>(__im) };
|
||||
}
|
||||
|
||||
constexpr complex<double> operator""i(unsigned long long __im)
|
||||
{
|
||||
return { 0.0, static_cast<double>(__im) };
|
||||
}
|
||||
|
||||
|
||||
constexpr complex<float> operator""if(long double __im)
|
||||
{
|
||||
return { 0.0f, static_cast<float>(__im) };
|
||||
}
|
||||
|
||||
constexpr complex<float> operator""if(unsigned long long __im)
|
||||
{
|
||||
return { 0.0f, static_cast<float>(__im) };
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_COMPLEX
|
||||
|
Reference in New Issue
Block a user