title: TypeScript Record type, C++ equivalent
body: <p>The following TypeScript passage defines a list of object types and a set of functions which match a string to determine which tag should be assigned to the string.</p>
  <pre><code>enum m {
    a,
    b,
    c
  }
  
  type obj = {
    source: string,
    type: m
  }
  
  const n: Record&lt;m, (char: string) =&gt; boolean&gt; = {
    [m.a](char: string) =&gt; false,
    [m.b](char: string) =&gt; false,
    [m.c](char: string) =&gt; false,
  }
  </code></pre>
  <p>I aim to use this code for lexical analysis, and for extra speed, I'd like to use C++, however as I'm very new to it, I'm not sure how to translate this into C++. If possible, I'd like as close a translation as possible, as this helps me understand what the code is doing far easier.</p>
  <p>I've tried using the following snippet to achieve the same behaviour, but I'm nowhere near experienced enough to work out anything beyond this.</p>
  <pre><code>bool fitsM(m type, std::string source) {
    if (type === m::a)
      return false; // do some checks here
    else if (type == m::b)
      return false; // more checks
    else if (type == m::c)
      return false; // yet more checks
    else
      return false;
  }
  </code></pre>
  <p>Obviously, this will work, however, as mentioned, I'm looking for a method that more closely resembles the typescript approach.</p>
  <p>Thanks for any help</p>