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

doesn't compile #8

Open
folkertvanheusden opened this issue Oct 28, 2021 · 0 comments
Open

doesn't compile #8

folkertvanheusden opened this issue Oct 28, 2021 · 0 comments

Comments

@folkertvanheusden
Copy link

folkertvanheusden commented Oct 28, 2021

/home/folkert/Projects2/libego/source/gtp/gtp.cpp: In member function ‘bool Gtp::Io::IsEmpty()’:
/home/folkert/Projects2/libego/source/gtp/gtp.cpp:42:13: error: cannot convert ‘std::istringstream’ {aka ‘std::__cxx11::basic_istringstream<char>’} to ‘bool’ in initialization
   42 |   bool ok = in;
      |             ^~
      |             |
      |             std::istringstream {aka std::__cxx11::basic_istringstream<char>}
make[2]: *** [gtp/CMakeFiles/gtp.dir/build.make:82: gtp/CMakeFiles/gtp.dir/gtp.cpp.o] Error 1

I propose the following (untested, it compiles though):

index 58dde30..9712241 100644
--- a/source/gtp/gtp.cpp
+++ b/source/gtp/gtp.cpp
@@ -39,10 +39,10 @@ bool Io::IsEmpty() {
   string s;
   std::streampos pos = in.tellg();
   in >> s;
-  bool ok = in;
+  bool ok = s.empty();
   in.seekg(pos);
   in.clear();
-  return !ok;
+  return ok;
 }
 
 void Io::PrepareIn () {
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

1 participant