[C++-sig] pickle support patches checked in

David Abrahams david.abrahams at rcn.com
Mon Jul 22 22:58:56 CEST 2002


----- Original Message -----
From: "Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com>
To: <c++-sig at python.org>
Sent: Monday, July 22, 2002 4:48 PM
Subject: Re: [C++-sig] pickle support patches checked in


> --- David Abrahams <david.abrahams at rcn.com> wrote:
> > > Hm, maybe it would be nice to generate a different compile-time error
> > > "must_inherit_from_pickle_group" just to give a better clue. Could
this
> > be
> > > done?
> >
> > Just pass a pointer to the group to a function accepting pickle_group
const
> > volatile*
>
> Here is what I did:
>
> Index: boost/python/object/pickle_support.hpp
> ===================================================================
> RCS file: /cvsroot/boost/boost/boost/python/object/pickle_support.hpp,v
> retrieving revision 1.4
> diff -r1.4 pickle_support.hpp
> 15a16,17
> > struct pickle_suite;
> >
> 20a23
> >   inline void must_be_derived_from_pickle_suite(pickle_suite const&) {}
>
> Index: boost/python/class.hpp
> ===================================================================
> RCS file: /cvsroot/boost/boost/boost/python/class.hpp,v
> retrieving revision 1.29
> diff -r1.29 class.hpp
> 202a203
> >
error_messages::must_be_derived_from_pickle_suite(PickleSuiteType());
>
> With EDG this comes out great:
>
> cxx: Error:
/tmp_mnt/net/boa/home1/rwgk/boost_mpl_ublas/boost/python/class.hpp,
> line 203: #312
>           no suitable user-defined conversion from
>           "<unnamed>::world_pickle_suite" to
>           "const boost::python::pickle_suite" exists
>           detected during instantiation of "boost::python::class_<T, X1,
X2,
>                     X3>::self &boost::python::class_<T, X1, X2,
>                     X3>::def_pickle(PickleSuiteType) [with
T=<unnamed>::world,
>                     X1=boost::python::detail::not_specified,
>                     X2=boost::python::detail::not_specified,
>                     X3=boost::python::detail::not_specified,
>                     PickleSuiteType=<unnamed>::world_pickle_suite]" at
line 58
>                     of "pickle1.cpp"
>
error_messages::must_be_derived_from_pickle_suite(PickleSuiteType());
> --------------------------------------------------------^
>
> You suggested "volatile const*" as opposed to the "const&" that I am
using. Is
> the "volatile" essential?

No more so than the const is.
However, I also suggested *, and I think volatile references bind
differently.

-Dave






More information about the Cplusplus-sig mailing list