Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] How to serialize third party libraryfunction
From: elizabeta petreska (elizabeta.petreska_at_[hidden])
Date: 2009-12-07 04:47:19


OK, I know installed the latest version of boost, which uses
has_new_operator type trait.

But , know I am getting compiler errors , for this minimal test program :

#include <boost/type_traits/has_new_operator.hpp>
class A {
public:
    void* operator new(std::size_t);
    void* operator new[] (size_t);
    void* operator new(std::size_t, void*);
};

int main()
{
    boost::has_new_operator<A>();
}

The compiler errors are :

Error 1:
  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

Error 2 :
 error C2866: 'boost::detail::has_new_operator_impl<T>::s1' : a const static
data member of a managed type must be initialized at the point of
declaration
\libs\boost\inc\boost-1_41\boost\type_traits\has_new_operator.hpp 93

Error 3:
Error 1 error C2668:
'boost::detail::has_new_operator_impl<T>::check_sig' : ambiguous call to
overloaded function
\libs\boost\inc\boost-1_41\boost\type_traits\has_new_operator.hpp 93

If you can see what the problem is
Thank you for your time

On Fri, Dec 4, 2009 at 5:25 PM, Robert Ramey <ramey_at_[hidden]> wrote:

>
> I notice that the crash maybe has to do something with that, that my
> CustomClass implements its own new and delete operators.
>
> I know that the default implementation of load_construct data uses operator
> placement ::new ( global new operator ) to allocate object when loading
> through pointer, a
>
> ** I don't know which version of boost you're using. The most recent
> version(s) make use of the type trait
> "has_new_operator" to call a class specific new operator. Without having a
> specific case to play with
> I don't know for sure, but it may address you're situation.
>
> Robert Ramey
>
>
>
> _______________________________________________
> 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