Boost logo

Boost :

Subject: [boost] [serialization] and [type traites]Problem with has_new_operator
From: Runar Undheim (R.Undheim_at_[hidden])
Date: 2009-06-29 07:46:32

I have a class that override two different new operators. This give an
"ambiguous call to overloaded function" error message in VisualC++2005.

Example on code that will give error:

class A {
    void* operator new(std::size_t);
    void* operator new(std::size_t, void*);

int _tmain(int argc, _TCHAR* argv[])
    return 0;

I think that the has_new_operator could be updated with a new check_sig3
test. Where the new(std::size_t, void*) is moved to the new check_sig3.

The serialization code use the has_new_operator to decide if it should
call T::new or ::new. But what should happen if only the operation new
for arrays is overridden? If T::new function only should be called when
the operator new(size_t) is overridden then the has_new_operator
function should be split into three different functions (ex.
has_new_operator, has_new_operator_array and has_new_operator_placement)?

- Runar

Boost list run by bdawes at, gregod at, cpdaniel at, john at