Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-07-10 12:19:03


Using the commented out signature (the one with .............., const
std::size_t key,............)
causes errors compiling on VC++.NET
It's not clear why declaring the key const should (in the philosophical
sense) cause any difficulties. following the actual thread
of errors was beyond our abilities at the time. Of course, the original
"error" didn't mention const anywhere, which didn't make finding the
problem any easier.

<rant>I sure wish the .NET compiler would give the "called from" trace back
on all of it's errors/warnings to facilitate finding the perceived
problems(like VC++6 did). This one we chased for over an hour</rant>

TimeStamps is equivalent to std::vector<double>
The error does NOT occur until time_stamp.def(set_ts_item,
"__setitem__"); is added to the source. That is, if the line is
removed, there is no error, but of course, we can't access set_ts_item either.
========================================================

// Sets the item corresponding to key in the map.
//void set_ts_item( TimeStamps& self, const std::size_t key, const double&
value)
void set_ts_item( TimeStamps& self, std::size_t key, const double& value)
{
self.at(key) = value;
}

#include <boost/python/class_builder.hpp>
namespace python = boost::python;
BOOST_PYTHON_MODULE_INIT(PythonTest)
{
// Create an object representing this extension module.
python::module_builder this_module("PythonTest");
// TimeStamps
python::class_builder<TimeStamps> time_stamp(this_module, "TimeStamps");
time_stamp.def(boost::python::constructor<>());
time_stamp.def(&TimeStamps::size, "__len__");
time_stamp.def(get_ts_item, "__getitem__");
time_stamp.def(set_ts_item, "__setitem__");
}
Victor A. Wagner Jr. http://rudbek.com
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk