alamaison  committed 21f9b5a

Make com_ptr::iid() public.

This allows code such as:

com_ptr<IInterface> ptr;
HRESULT hr = BindToObject(ptr.iid(), reinterpret_cast<void**>(ptr.out()));

instead of:

com_ptr<IInterface> ptr;
HRESULT hr = BindToObject(uuidof(, reinterpret_cast<void**>(ptr.out()));

Removing the strange 'uuidof(' makes it more obvious what is going on here. There is no loss of encapsulation by making iid() public; if anything it improves it by preventing a call to in().

  • Participants
  • Parent commits d04a939
  • Branches default

Comments (0)

Files changed (1)

File include/comet/ptr.h

 	template<typename Itf> class com_ptr
+	public:
 		const uuid_t& iid() const throw()
 		{ return uuidof<Itf>();	}
+	private:
 		enum{ chooser_matches_= impl::iunknown_chooser<Itf>::matches };
 		typedef typename impl::IUnknown_caller< chooser_matches_ > Unknown_caller_;