#154 typedefs to argumetns of template classes

open
nobody
Foundation (22)
5
2012-09-14
2012-02-02
Jan Vana
No

As the stl library has inside template based classes typedefs to arguments, I would like to have also this feature in Poco.

ie.
template <class TArgs,="" class="" TStrategy,="" class="" TDelegate,="" class="" TMutex="FastMutex">
class AbstractEvent
{
public:
typedef TArgs Args;
...
}

then in the code you can use this:

struct EventData {
//something here ...
}
class Foo {
public:
typedef Poco::BasicEvent<EventData> SomethingHappendEvent;
SomethingHappendEvent SomethingHappend;
}

class Foo2 {
void onSomethingHappend(Foo::SomethingHappendEvent::Args & args);
}

the advantage is, when you decide to change the EventData to something else, then you don't have to touch the onSomethingHappend declaration and also it brings other possibilities for generic programming.

Discussion

  • partially implemented for AbstractEvent in 1.4.4