#include <iostream>
#include <map>
#include <functional>
#include <string>

using namespace std;

void f_1234() { cout << "1234\n"; }

void f_ABCD() { cout << "ABCD\n"; }

void f_default() { cout << "default\n"; }

void f( const char* s )
{
  using function_t = std::function< void() >;
  using string_to_function = map< string, function_t >;

  static string_to_function m =
  {
    {"1234", f_1234}, // assosciate "1234" to function f_1234
    {"ABCD", f_ABCD}, // assosciate "ABCD" to function f_ABCD
  };

  auto i = m.find( s );

  return i == m.end()
    ? f_default() // not found in map
    : i->second(); // found, so we call the function
}

int main()
{
  f( "1234" );
  f( "ABCD" );
}
