15 Jun 2012 22:47
Adding element_type in scoped_refptr?
Xiaohan Wang <xhwang <at> chromium.org>
2012-06-15 20:47:44 GMT
2012-06-15 20:47:44 GMT
I was trying to use ::testing::IsNull and ::testing::NotNull on
scoped_refptr? I saw in the doc that it's working for both raw and
smart pointers. But I tried and it's not working. I investigated a
little bit and found that GetRawPointer needs element_type to be
defined in the Pointer type:
template <typename Pointer>
inline typename Pointer::element_type* GetRawPointer(const Pointer& p)
{
return p.get();
}
It turns out that element_type is not defined in scoped_refptr. I
added
typedef T element_type;
in the definition of template <class T> class scoped_refptr and at
least IsNull and NotNull compiled with scoped_refptr for me.
My question is: Is there any reason element_type is not defined in
scoped_refptr? If not, does it worth adding it? This should not break
any existing code, but I wonder if this could cause any possible
misuse in the future.
--
--
Chromium Developers mailing list: chromium-dev <at> chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
(Continue reading)
RSS Feed