Hi,
the question is: how should I assign boost::interprocess::unique_ptr
returned from a factory function, possibly using boost::move, in C++03?
Here's an example:
---
#include
using namespace boost::interprocess;
class my_class {
public:
my_class() {}
};
struct my_class_deleter {
void operator()(my_class *p) {}
};
typedef unique_ptr uptr;
uptr create() {
return uptr();
}
int main() {
uptr x;
x = create();
//
return 0;
}
---
The problem is that gcc fails to compile the above code saying:
main.cpp:22: error: ambiguous overload for ‘operator=’ in ‘x = create()()’
../../boost_latest/boost/interprocess/smart_ptr/unique_ptr.hpp:211:
note: candidates are: boost::interprocess::unique_ptr&
boost::interprocess::unique_ptr::operator=(boost::rv >&) [with
T = my_class, D = my_class_deleter]
../../boost_latest/boost/interprocess/smart_ptr/unique_ptr.hpp:249:
note: boost::interprocess::unique_ptr&
boost::interprocess::unique_ptr::operator=(int
boost::interprocess::unique_ptr::nat::*) [with T = my_class, D =
my_class_deleter]
I use gcc v4.4.3 and Boost v1.51.0.
BTW: I posted the same question on StackOverflow:
http://stackoverflow.com/questions/13086428/how-should-i-assign-boostinterpr...