[C++-sig] non-const arguments

Enrico Ng enrico at fnal.gov
Tue Aug 6 23:41:46 CEST 2002

I am new to boost and am attepting to use V2.

I get the "TypeError: bad argument type for built-in operation" error
message from python.  It seems that since the variable "idum" is not
const and changes, python can't handle it.

I have looked around your documentation and the copy_non_cost_reference
class seems close to what I need but I am not sure.

Here is some of the relavent code:

class MathLib {
  static Real ran1(Integer &idum);   <- idum is modified


#include <boost/python/class.hpp>
#include <boost/python/module.hpp>

namespace python = boost::python;

   .def("ran1", &MathLib::ran1)

More information about the Cplusplus-sig mailing list