aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorEd Smith-Rowland <3dw4rd@verizon.net>2013-10-23 00:09:19 +0000
committerEdward Smith-Rowland <emsr@gcc.gnu.org>2013-10-23 00:09:19 +0000
commitae5543e66213b694f07474cc98fba9d4c5b0defc (patch)
tree0b96fbfd96ca1a11dbecbcfedf40258a66d603eb /libstdc++-v3/include
parentdf2ba612878f96751235dae5f926f829d4245c92 (diff)
downloadgcc-ae5543e66213b694f07474cc98fba9d4c5b0defc.zip
gcc-ae5543e66213b694f07474cc98fba9d4c5b0defc.tar.gz
gcc-ae5543e66213b694f07474cc98fba9d4c5b0defc.tar.bz2
Implement N3779 - User-defined Literals for std::complex, part 2 of UDL for Standard Library Types
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. From-SVN: r203940
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/std/complex34
1 files changed, 34 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index 58edb4f..ff04ae6 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