Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-27 01:13:55


Hi Robert,

> Vladimir wrote:
>
>> ......./boost/boost/serialization/scoped_ptr.hpp:36: error: `make_nvp'
>> undeclared (first use this function)
>
>>The attached patch fixes the problem.
>
>>BTW, Robert, this problem was introduce when you moved the content of the
>>header from boost::serialization to just boost::. What was the rationale?
>>The log only says:
>
>> fixes for cw/comeau implement ADL
>
>
> This was changed in order to function with compilers that implement
> two-phase lookup. This is described (somewhat) in them manual under the
> section:Reference/Class Serialization/Free Functions/Namespaces for Free
> Function Overrides

I think the docs are a bit unclear:

   The question arises as to which namespace free serialization functions
   should be part of.

   The options for this depend on:

   Whether or not the compiler implements Argument Dependent Lookup.
   whether (***** 'or' missing?)not the compiler implements Two Phase Lookup
   whether or (**** 'not' missing?) the the type to be serialized is a
       dependent type.

What's the meaning of 'dependent' type? Do you mean 'dependent in context of
'serialize'? Then, if I write:

   template<class Archive>
   inline void serialize(
    Archive & ar,
    my_class & t,
    const unsigned long int file_version) {}

then the type to be serialized is never dependent type. Or do you refer to a
case where 'serialize' is templated on saved type? I'd suggest that you
write that explicitly, as "dependent type" is a bit vague.

> Before this change, there is a problem with compilers which implement
> two-phase lookup. Overrides for templates have to be defined before their
> usage in another template.

It would be great if you could put the explanation to the docs. BTW, I start
to wonder if two-phase lookup does any good, for all additional portability
problems that it has.

> This conflicted with the implementation of
> BOOST_CLASS_EXPORT. To support these compilers, I had to either put
> non-intrusive serialization functions in the same namespace as the type
> being serialized or re-organize export. The latter is non-trivial and
> couldn't be guaranteed to be ready in time for release (at least at the
> time the issue came up).

Is the issue really with BOOST_CLASS_EXPORT? It seems that on compilers with
two-phase lookup, if 'save' overloads are in boost::serialization, they
must be seen before any code which uses 'save'. And this requirement is not
specific to BOOST_CLASS_EXPORT. And also, btw, the table says
boost::serialization is suitable for 'save' overload if compiler supports
ADL, two-phase lookup and type is dependent. Why is it so?

- Volodya


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