[C++-sig] Apparent bug
david.abrahams at rcn.com
Wed Jul 10 22:54:57 CEST 2002
Re-posting the same report doesn't make it any clearer what your problem
is. Also note that your tabs are stripped so that there's no indentation.
Is there a bug in the library?
Oh... after re-reading about 5 times I see what you're talking about. This
is a VC++ compiler bug, not a library bug. VC++ incorrectly propagates the
constness of declared argument types into the type of the function
signature. Nothing you can do about it, sorry (other than declaring the
function initially with a prototype using a non-const argument -- you can
still make the function definition use a const argument).
----- Original Message -----
From: "Victor A. Wagner, Jr." <vawjr at rudbek.com>
To: <c++-sig at python.org>
Sent: Wednesday, July 10, 2002 2:42 PM
Subject: [C++-sig] Apparent bug
> 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
> 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
> // Sets the item corresponding to key in the map.
> //void set_ts_item( TimeStamps& self, const std::size_t key, const
> 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;
> // 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(&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"
> C++-sig mailing list
> C++-sig at python.org
More information about the Cplusplus-sig