You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
619 B

  1. /*
  2. * helpers.h
  3. *
  4. * Created on: 16 Apr 2016
  5. * Author: harold
  6. */
  7. #ifndef PYTHON_HELPERS_H_
  8. #define PYTHON_HELPERS_H_
  9. #include <sstream>
  10. #include <string>
  11. /**
  12. * Helper function to get a string out of the stream operator.
  13. * Used for __str__ functions.
  14. */
  15. template<typename T>
  16. std::string streamToString(T const & t) {
  17. std::stringstream ss;
  18. ss << t;
  19. return ss.str();
  20. }
  21. // Be warned: Enabling something like this will break everything about Monomial,
  22. // as to Python the shared_ptr (Arg) IS the Monomial
  23. // //PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
  24. #endif /* PYTHON_HELPERS_H_ */