Bonjour,
Mon compilo ne trouve pas le membre m_action pour le constructeur command, alors qu'il est juste au dessus de lui
Quelqu'un saurait ce qui cloche ?
Erreur:
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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 #ifndef ADMINCOMMANDCENTER_H #define ADMINCOMMANDCENTER_H #include <functional> #include <unordered_map> namespace game { typedef unsigned short account_level_t; enum AccountLevels: unsigned short { Player = 1, Intern, GM, Admin }; } class AdminCommandCenter { public: typedef void(action_functor)(...); static void register_command(unsigned short command__, game::account_level_t level, const action_functor& action); template<typename... Args> static void execute(unsigned short command__, game::account_level_t level, Args&... args) { acc_iterator entry(m_actions.find(command__)); if(entry == std::end(m_actions)) { throw unknown_command(); } if(level == game::AccountLevels::Player) { throw no_rights(); } else if(level < entry->second.m_level) { throw bad_rights(); } else { entry->second.m_action(std::forward<Args...>(args...)); } } AdminCommandCenter() { } virtual ~AdminCommandCenter() {} class unknown_command { public: unknown_command() {} virtual ~unknown_command() throw() {} }; class bad_rights { public: bad_rights() {} virtual ~bad_rights() throw() {} }; class no_rights { public: no_rights() {} virtual ~no_rights() throw() {} }; class command { public: const game::account_level_t m_level; const action_functor m_action; command(game::account_level_t l, const action_functor& f) : m_level(l), m_action(f) {} virtual ~command() {} }; private: typedef std::unordered_map<unsigned short, command> acc_map; typedef acc_map::iterator acc_iterator; static acc_map m_actions; }; #endif
Merci,prog.cpp: In constructor ‘AdminCommandCenter::command::command(game::account_level_t, void (&)(...))’:
prog.cpp:67:81: error: class ‘AdminCommandCenter::command’ does not have any field named ‘m_action’
nico
Partager