Skip to content

Commit c84289f

Browse files
author
aidan.belton
committed
Add host-only ostream and istream operators
1 parent 39d7a50 commit c84289f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

sycl/doc/extensions/proposed/sycl_ext_oneapi_complex.asciidoc

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,17 @@ namespace oneapi {
210210

211211
// operator<<
212212
template<typename T>
213-
bool operator<<(sycl::stream&, const complex<T>&);
213+
const sycl::stream& operator<<(sycl::stream&, const complex<T>&);
214+
215+
// Note: The below << and >> operator with basic_ostream and basic_istream
216+
// are host-only.
217+
template<class T, class charT, class traits>
218+
std::basic_ostream<charT, traits>&
219+
operator<<(std::basic_ostream<charT, traits>&, const complex<T>&);
220+
221+
template<class T, class charT, class traits>
222+
std::basic_istream<charT, traits>&
223+
operator>>(std::basic_istream<charT, traits>&, const complex<T>&);
214224

215225
} // namespace oneapi
216226
} // namespace ext
@@ -300,8 +310,12 @@ the decimal and an imaginary component equal to 0.
300310
|Compares complex number x and decimal y and returns true if they are different, otherwise false.
301311
|`gencomplex operator!=(const genfloat& x, const gencomplex& y);`
302312
|Compares decimal x and complex number y and returns true if they are different, otherwise false.
303-
|`const stream& operator<<(sycl::stream& x, const gencomplex y);`
304-
|Streams the complex number x in the format "(real,imaginary)" into `sycl::stream` x and return the result.
313+
|`const sycl::stream& operator<<(sycl::stream& x, const gencomplex& y);`
314+
|Streams the complex number y in the format "(real,imaginary)" into `sycl::stream` x and return the result.
315+
|`std::basic_ostream& operator<<(std::basic_ostream& x, const gencomplex& y);`
316+
|Streams the complex number y in the format "(real,imaginary)" into `std::basic_ostream` x and return the result. This is only available for the host.
317+
|`std::basic_istream& operator>>(std::basic_istream&, const gencomplex& y);`
318+
|Streams the string given in the format "(real,imaginary)" into complex number y. This is only available for the host.
305319
|===
306320

307321

0 commit comments

Comments
 (0)