]> www.ginac.de Git - ginac.git/blobdiff - doc/examples/mystring.cpp
[BUGFIX] Fix crash in parser.
[ginac.git] / doc / examples / mystring.cpp
index b86f18b90da571a75a646829e26e92a64547fd93..655fe825f93b7d5b3ffe96d8ed7252aeeb44b3c4 100644 (file)
@@ -4,9 +4,12 @@
 #include <iostream>
 #include <string>   
 #include <stdexcept>
-using namespace std;
-
+#ifdef IN_GINAC
+#include "ginac.h"
+#else
 #include <ginac/ginac.h>
+#endif
+using namespace std;
 using namespace GiNaC;
 
 class mystring : public basic
@@ -14,7 +17,7 @@ class mystring : public basic
        GINAC_DECLARE_REGISTERED_CLASS(mystring, basic)
 public:
        mystring(const string &s);
-       ex eval(int level) const;
+       ex eval() const override;
 private:
        string str;
 
@@ -54,7 +57,7 @@ void mystring::do_print(const print_context &c, unsigned level) const
  * evaluation: all strings automatically converted to lowercase with
  * non-alphabetic characters stripped, and empty strings removed
  */
-ex mystring::eval(int level) const
+ex mystring::eval() const
 {
        string new_str;
        for (size_t i=0; i<str.length(); i++) {