Hello,
Un typedef sur une liste de types est-il possible ?
Quelque chose du genre
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 template <class... Args> class Event { public: typedef const Args&... ArgsType; // ça typedef std::function<void(const Args&...)> FctType; //... }; // utilisation class EventA { public: typedef Event<int, int> IntIntEventType; typedef Event<int> IntEventType; void addIntInt(IntIntEventType::FctType fct) { m_eventIntInt.add(fct); } void fireIntInt(IntIntEventType::ArgsType args...) { m_eventIntInt.fire(args...); } void addInt(IntEventType::FctType fct) { m_eventInt.add(fct); } void fireInt(IntEventType::ArgsType args...) { m_eventInt.fire(args...); } private: IntIntEventType m_eventIntInt; IntEventType m_eventInt; };
Partager