class control
{
private:
Automator auto_maton;
std::map<state, void(Automator::*)()> lib;
public:
control();
void execute();
void simulate();
};
///for my constructor i got this
control::control()
:auto_maton{}, lib/*(*/{ { state::default, Automator::get_card }, { state::login, Automator::get_pin },
{ state::process, Automator::transact }, { state::done, Automator::complete } }/*)*/
{}
//for my usage i have this
void control::execute()
{
auto st=auto_maton.get_state();
auto_maton.lib[st]();
}
the class simulates a state controlled Atm machine but it fails with a whole bunch of error, i just don't know what's wrong with it av tried a couple variation but all failed
errors!
Error 1 error C2797: 'mta::control::lib': list initialization inside member initializer list or non-static data member initializer is not implemented 113 1 mta local state
Error 2 error C2039: 'lib' : is not a member of 'mta::Automator' 118 1 mta local state
Error 3 error C4716: 'reeap' : must return a value 10 1 mta local state
4 IntelliSense: class "mta::Automator" has no member "lib" 118 15 mta local state
what should i change? thanks.
EDIT: state is a global strongly type enumeration , all the functions in in the class Automator have a common function signature void() , when a function executes successfully it changes the state of the class automator.
1) VS AFAIK still not implemented list initializaton in member init.
Rest are probably stems from first.
auto_maton.lib[st](); to execute member function through pointer, you need to provide instance, use member function selection syntax ( .* or ->* ), and use brackets: ( this->*auto_maton.lib[st] )()
std::regex pattern("([[:alpha:]])(\\d{3})([.- ])?(\\d{4})([.- ])?(\\d{4})");
what's wrong here i mean i wanted a pattern similar to this one X746-9844-9847 for testing
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.
This is usually a result of calling a function declared with one calling convention with a
function pointer declared with a different calling convention.