Opened 16 years ago
Closed 16 years ago
#806 closed Bugs (Rejected)
serialization of classes with overloaded operator & fails
| Reported by: | nobody | Owned by: | Robert Ramey |
|---|---|---|---|
| Milestone: | Component: | serialization | |
| Version: | None | Severity: | |
| Keywords: | Cc: |
Description
the serialization of the following class fails to compile
at line 363 in detail/iserializer.hpp, struct load_standard, method invoke, line
void * x = & const_cast<typex &>(t);
class wrapped_value
{
public:
const int* operator & ()
{ // returns the address of the wrapped integer, which may noy be the same as the address of the instance
return &a;
}
template <typename Archive>
void serialize(Archive& ar, const unsigned version)
{
ar & a;
}
private:
int a;
};
due to the overloaded '&' operator getting the address of the instance fails. a proposed patch is
void * x = boost::addressof( const_cast<typex &>(t) );
which seems to compile and work correctly
cheers
Note:
See TracTickets
for help on using tickets.
