Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operator>> for complex<T> uses std::ostream, not std::istream #2313

Closed
brian-kelley opened this issue Sep 11, 2019 · 0 comments
Closed

operator>> for complex<T> uses std::ostream, not std::istream #2313

brian-kelley opened this issue Sep 11, 2019 · 0 comments
Assignees

Comments

@brian-kelley
Copy link
Contributor

In Kokkos_Complex.hpp, there are operator overloads to allow input and output of complex through std streams. But the input operator>>() takes a std::ostream&, not a std::istream&. When I tried to read a complex from a std::istringstream, I got a "no matching function to call" error, since istringstream is not a subclass of ostream.

Line 790 or so (bottom of file) in Kokkos_Complex.hpp (in develop, but the issue is also present in master):

template<class RealType>
std::ostream& operator << (std::ostream& os, const complex<RealType>& x) {
  const std::complex<RealType> x_std (Kokkos::real (x), Kokkos::imag (x));
  os << x_std;
  return os;
}

template<class RealType>
std::ostream& operator >> (std::ostream& os, complex<RealType>& x) {
  std::complex<RealType> x_std;
  os >> x_std;
  x = x_std; // only assigns on success of above
  return os;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants