[C++-sig] Re: operator ->, cast operator

David Abrahams dave at boost-consulting.com
Sun Mar 13 01:14:31 CET 2005


"Leonard \"paniq\" Ritter" <paniq at paniq.org> writes:

>> You also need 
>>
>>namespace Mu
>>{
>>   template <class T>
>>   T* get_pointer(Ptr<T> const& p)
>>   {       return p.get();  // or something
>>   }
>>}
>>
>>
>>
> in my case GetObject() which needed to be const. assuming the problem 
> was that i have not defined const cast operators i declared various 
> flavors of cast operators in Ptr<>, but without luck. only adding 
> get_pointer would make it work.
>
> is the requirement of get_pointer somewhere mentioned in the 
> documentation? i was unable to find it.

It's in the description of the Dereferenceable concept, which is
referenced in the place where you found a reference to pointee<>.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list