Hi
Why there is no "counted_ptr& operator= (pointee_type* p)" ?
This question has arisen when I was searching why following piece of
code won't compile:
arg::counted_ptr<testc;
c = new test;
And compiler wasn't very helpful with this:
g++ -ansi -pedantic -Wall -W -c test.cpp
arglib/arg_shared.h: In member function `arg::counted_ptr<pointee_type>&
arg::counted_ptr<pointee_type>::operator=(const
arg::typed_reference<pointee_type>&) [with pointee_type = test]':
test.cpp:8: instantiated from here
arglib/arg_shared.h:184: error: `void
arg::typed_reference<pointee_type>::increment_stro ng_references() const
[with pointee_type = test]' is protected
arglib/arg_shared.h:313: error: within this context
BTW Why the g++ hasn't just complain about wrong type?
Finally I've looked on the docs carefully and I see that there are only
following operator= defined:
counted_ptr& operator= (const base_type& rhs)
counted_ptr& operator= (const counted_ptr& rhs)
And only way to initialize the counted_ptr is to call the reset method
void reset (pointee_type* p)
//Delete existing contents (and take ownership of p).
So - is it arglib's author's oversight (I don't think so), am I
misunderstanding something (problably) or everything works as I
understand it and there is an explanation for not implementing
"operator= (pointee_type* p)"?
--
mati