Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] How to serialize third partylibraryfunction
From: elizabeta petreska (elizabeta.petreska_at_[hidden])
Date: 2009-12-08 06:19:07


I am using the professional edition of Visual Studio 2005.

>>You could also make a template class that handles your serialization of
the third party library classes (you probably want to split save/load). A
>>wrapper or holder class if you will that should only exist on the stack..

I don't understand you what you mean with this. Sorry , can you explain me a
little ?

Also in this moment I solved the problem with making explicit specialization
for the heap_allocator template , i.e I made the following :
namespace boost
{
    namespace archive
    {
        namespace detail
        {
            template<>
            struct heap_allocator<CustomClass>
            {
                 static CustomClass* invoke()
                {
                    return static_cast<CustomClass *>( new CustomClass ); //
this one uses CustomClass specific new operator
                }
            };

        }
    }
}

And I also made load/save pair for my CustomClass.

The problem is that I have a lot of such custom classes , and I should write
explicit specialization for heap_allocator template for each of them. :(
So the most easier way would be to have the compiler error fixed.

On Tue, Dec 8, 2009 at 11:49 AM, Rune Lund Olesen <rune.olesen_at_[hidden]>wrote:

> Hello
>
> You could also make a template class that handles your serialization of the
> third party library classes (you probably want to split save/load). A
> wrapper or holder class if you will that should only exist on the stack..
> That way you can serialize the classes in any way you want to - while still
> getting benifits from the serialization library. The downside is the added
> complexity and in my case i had to make sure that pointers are not released
> before your done serializing, since the library tracks them (otherwise the
> same address could be reused and the serialization library will identify it
> as the same object).
>
> Not sure if that is the kind of solution you are looking for though, might
> be easier to have the compile error fixed.
>
> Regards
> Rune
>
>
> On Tue, Dec 8, 2009 at 10:12 AM, John Emmas <johne53_at_[hidden]> wrote:
>
>> ----- Original Message ----- From: "elizabeta petreska"
>>
>>
>>>>> error C2975: 'b1' : invalid template argument for
>>>>> 'boost::type_traits::ice_or', expected compile-time constant expression
>>>>> \libs\boost\inc\boost-1_41\boost\type_traits\has_new_operator.hpp
>>>>> 100
>>>>>
>>>>> I just tried compiling your code with VS8 (Express Edition) and got
>> the same
>> error. Are you also using Express Edition?
>>
>> John
>>
>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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