Saving some typing.
One item on my C++ wishlist is a syntax for inlining typedefs into the base class list on a class declaration:
class CMyClass
: public ATL::CComObjectRootEx<ATL::CComSingleThreadModel>
, public ATL::CComCoClass<CMyClass, &__uuidof(MyClass)>
, public ATL::IConnectionPointContainerImpl<CMyClass>
, public ATL::IConnectionPointImpl<CMyClass,
&__uuidof(IMyClassEvents)>
, public ATL::IConnectionPointImpl<CMyClass,
&__uuidof(IMyClassOtherEvents)>
, public IMyClass
The two connection points result in a duplicated name, m_vec
. To get
the list of listeners to deliver any given event to, contortions like
ATL::IConnectionPointImpl<CMyClass, &__uuidof(IMyClassOtherEvents)>::m_vec
are necessary. These usually
become typedefs:
private:
typedef ATL::IConnectionPointImpl<CMyClass, &__uuidof(IMyClassEvents)> events_cp;
typedef ATL::IConnectionPointImpl<CMyClass, &__uuidof(IMyClassOtherEvents)> otherevents_cp;
Then a relatively simple otherevents_cp::m_vec
leads to the right
container, but it requires regurgitating the entire base class type in
the typedef.
Something like this would be really nice to have instead:
class CMyClass
: public ATL::CComObjectRootEx<ATL::CComSingleThreadModel>
, public ATL::CComCoClass<CMyClass, &__uuidof(MyClass)>
, public ATL::IConnectionPointContainerImpl<CMyClass>
, public ATL::IConnectionPointImpl<CMyClass,
&__uuidof(IMyClassEvents)> [private: events_cp]
, public ATL::IConnectionPointImpl<CMyClass,
&__uuidof(IMyClassOtherEvents)> [private: otherevents_cp]
, public IMyClass
Wouldn’t it?