|
Boost Users : |
Subject: Re: [Boost-users] true typedef (true_typedef) implemented in boost?
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-07-17 11:54:41
Zitat von Robert Ramey <ramey_at_[hidden]>:
> Stefan Strasser wrote:
>> Zitat von Ryan Gallagher <ryan.gallagher_at_[hidden]>:
>>
>>> alfC <alfredo.correa <at> gmail.com> writes:
>>>
>>>> I stumbled upon the concept of true typedef, or strong typedef in
>>>> opposition to usual typedef which are weak.
>>> [snip]
>>>> I was wondering if this is already implemented in some corner of
>>>> Boost, or as a detail implementation.
>>>
>>> There's a detail impl in serialization, I believe.
>>> Search for BOOST_STRONG_TYPEDEF
>>
>> there is more interesting stuff in Boost.Seriailzation that could be
>> part of boost in general.
>> - especially seriailzation::singleton, because it requires linking
>> to the serialization library even though you don't serialize anything.
>
> Hmmm - the whole purpose of boost::serialization::singleton was to be
> header only and require no linking against any other library. Did
> I get this wrong?
I just remember that I got linking errors related to singletons when
using them in (Boost.)Intro. but I'll doublecheck, maybe I'm using
something else from Boost.Seriailzation that caused these.
>
>> - ptr_serialization_support in
>> http://www.boost.org/doc/libs/1_41_0/boost/serialization/export.hpp
>> which forces instantiation of a function.
>
>> this apparently cannot be
>> implemented platform independently, so Boost.Config might be the right
>> library for it?
>
> These are related to boost::serialization::extended_type_info which extends
> the standard type_info facility in accordance with the needs of boost
> serialization. This results (sort of as a side effect) support for runtime
> plugin - sort of like a poor man's C++ COM.
I'm not sure if we're talking about the same thing here as I don't see
the connection. I meant mostly this code:
template <class Archive, class Serializable>
struct ptr_serialization_support
{
# if defined(BOOST_MSVC) || defined(__SUNPRO_CC)
virtual BOOST_DLLEXPORT void instantiate() BOOST_USED;
# elif defined(__BORLANDC__)
static BOOST_DLLEXPORT void instantiate() BOOST_USED;
enum { x = sizeof(instantiate(),3) };
# else
static BOOST_DLLEXPORT void instantiate() BOOST_USED;
typedef instantiate_function<
&ptr_serialization_support::instantiate
> x;
# endif
};
which forces instantiations in order to register serializers as part
of static initialization.
AFAIK there is no way in C++ or boost to initialize data on startup
that is not specifically referred to (like in a static variable), but
only modifies static data. like you do in Boost.Serialization to
create the serializer maps.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net