diff options
| author | emsr <emsr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-23 00:09:19 +0000 |
|---|---|---|
| committer | emsr <emsr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-23 00:09:19 +0000 |
| commit | 9d4f199cb467963c38de1ab5f53595a7d0640267 (patch) | |
| tree | 0b96fbfd96ca1a11dbecbcfedf40258a66d603eb /libstdc++-v3/include/std/complex | |
| parent | 848880a65987f3f3aadc6a1d5d9b4eff56de4920 (diff) | |
| download | ppe42-gcc-9d4f199cb467963c38de1ab5f53595a7d0640267.tar.gz ppe42-gcc-9d4f199cb467963c38de1ab5f53595a7d0640267.zip | |
2013-09-27 Ed Smith-Rowland <3dw4rd@verizon.net>
Implement N3779 - User-defined Literals for std::complex,
part 2 of UDL for Standard Library Types
* include/std/complex: Add complex literal operators.
* testsuite/26_numerics/complex/literals/types.cc: New.
* testsuite/26_numerics/complex/literals/values.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203940 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/complex')
| -rw-r--r-- | libstdc++-v3/include/std/complex | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 58edb4f54dd..ff04ae6425e 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -1924,6 +1924,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION conj(_Tp __x) { return __x; } +#if __cplusplus > 201103L + +inline namespace literals { +inline namespace complex_literals { + + constexpr std::complex<float> + operator""if(long double __num) + { return std::complex<float>{0.0F, static_cast<float>(__num)}; } + + constexpr std::complex<float> + operator""if(unsigned long long __num) + { return std::complex<float>{0.0F, static_cast<float>(__num)}; } + + constexpr std::complex<double> + operator""i(long double __num) + { return std::complex<double>{0.0, static_cast<double>(__num)}; } + + constexpr std::complex<double> + operator""i(unsigned long long __num) + { return std::complex<double>{0.0, static_cast<double>(__num)}; } + + constexpr std::complex<long double> + operator""il(long double __num) + { return std::complex<long double>{0.0L, __num}; } + + constexpr std::complex<long double> + operator""il(unsigned long long __num) + { return std::complex<long double>{0.0L, static_cast<long double>(__num)}; } + +} // inline namespace complex_literals +} // inline namespace literals + +#endif // C++14 + _GLIBCXX_END_NAMESPACE_VERSION } // namespace |

