Call to non-constexpr function 'std::map...'
<p>I'm attempting to create a pseudo-media center <em>thing</em> on an Arduino and a breadboard, not all that complicated but this is my first project with C++ that amounted to more than 'Hello world!' or a calculator.</p>

<p>Digressing to my point though, I started rewriting almost the entire original program, and in an effort to clean things up, started using a map to hold the keys and values (IR codes), and to further organize it, put the assignments inside of a function (IR_generateMap()), but I'm getting an error when I compile it.</p>

<pre><code>C:\Users\trevo\Documents\Arduino\improvedIRRemote\improvedIRRemote.ino: In function 'void IRLoop(bool)':

improvedIRRemote:78: error: call to non-constexpr function 'std::map&lt;Key, T, Compare, Allocator&gt;::reference std::map&lt;Key, T, Compare, Allocator&gt;::operator[](const key_type&amp;) [with Key = std::basic_string&lt;char&gt;; T = int; Compare = std::less&lt;std::basic_string&lt;char&gt; &gt;; Allocator = std::allocator&lt;int&gt;; std::map&lt;Key, T, Compare, Allocator&gt;::reference = int&amp;; std::map&lt;Key, T, Compare, Allocator&gt;::key_type = std::basic_string&lt;char&gt;]'

       case IRCodes["Power Button"]:

                                  ^

improvedIRRemote:78: error: call to non-constexpr function 'std::map&lt;Key, T, Compare, Allocator&gt;::reference std::map&lt;Key, T, Compare, Allocator&gt;::operator[](const key_type&amp;) [with Key = std::basic_string&lt;char&gt;; T = int; Compare = std::less&lt;std::basic_string&lt;char&gt; &gt;; Allocator = std::allocator&lt;int&gt;; std::map&lt;Key, T, Compare, Allocator&gt;::reference = int&amp;; std::map&lt;Key, T, Compare, Allocator&gt;::key_type = std::basic_string&lt;char&gt;]'

exit status 1
call to non-constexpr function 'std::map&lt;Key, T, Compare, Allocator&gt;::reference std::map&lt;Key, T, Compare, Allocator&gt;::operator[](const key_type&amp;) [with Key = std::basic_string&lt;char&gt;; T = int; Compare = std::less&lt;std::basic_string&lt;char&gt; &gt;; Allocator = std::allocator&lt;int&gt;; std::map&lt;Key, T, Compare, Allocator&gt;::reference = int&amp;; std::map&lt;Key, T, Compare, Allocator&gt;::key_type = std::basic_string&lt;char&gt;]'
</code></pre>

<p>I've looked up and attempted to understand errors with non-constexpr calls, but to be perfectly honest, I don't understand how what I'm trying to do with the map relates to the problems being described in the posts that deal with said error.</p>

<pre><code>#include &lt;IRremote.h&gt;
#include &lt;StandardCplusplus.h&gt;
#include &lt;map&gt;

//Variables responsible for recieving and decoding IR signals/codes.
IRrecv receiver(10);    //IR receiver initialization.
decode_results results; //Object that is responsible for decoding the IR signal.

//Variables responsible for tracking channel changing.
int channel = 1;                          //The active channel.
int desiredChannel = "";                  //The string that is used to concatenate the numbers pressed on the remote keypad together.
int channelEnterDelay = 4000;             //The delay between the last time a number was pressed on the remote keypad and when the desiredChannel is cleared.
unsigned long channelEnterStartTime = 0;  //The time in which that last number was pressed on the remote keypad.
String intConverter;                      //The string responsible for casting an integer to a string.

//Variables responsible for tracking volume changing.
int volume = 50;      //The current volume.
int lastVolume = 50;  //Holds the value of the volume previous to the volume being muted.
bool isMuted = false; //Whether or not the sound has been muted.

//Map responsible for the setting and getting of IR codes and their respective keys.
const std::map&lt;std::string, int&gt; IRCodes;

//Miscellanious Stuff - mostly waiting for depreciation.
int IRFlasherPin = 8;
int mode = 0;
int IRFlasherBlinkRate = 10;

//Debug mode shows channel switching info when entering from the remote keypad, turn it off to declutter the serial feed if it is not being used.
bool DEBUG_MODE = false;

void setup() {

  receiver.enableIRIn();          //Tells the receiver to start listening for IR communication.
  pinMode(IRFlasherPin, OUTPUT);  //Configuring the pin that flashes upon recieving the 'excess communication' IR code.
  Serial.begin(9600);             //Begins serial communication at 9600 baud.
  IR_generateMap();               //Sets all of the values for the map of IR keys and values.

  //Ready message.
  Serial.println("The Arduino is ON and ready for communication.");
  if (DEBUG_MODE) { Serial.println("Also please note that debug mode has been preemptively enabled. The serial monitor can be expected to be much more cluttered than normal. To disable this, press the 'U/SD' button on the remote."); }
  Serial.println();

}

void loop() {

  //Pre-loop checks.
  //empty

  IRLoop(true);

}

void IRLoop(bool toldToContinueLooking) {

  if (receiver.decode(&amp;results)) {

    switch(results.value) {

      case IRCodes["Power Button"]:
        Serial.println("Power Toggle");
        break;

      default:
        if (DEBUG_MODE) {

          Serial.print("Extraneous code: ");
          Serial.print(results.value);

        }
        break;

    }

  }

  if (toldToContinueLooking) { receiver.resume(); }

}

void IR_generateMap() {

  //General Keys
  IRCodes["Power Button"] = 16753245;
  IRCodes["Mode Button"]          = 16736925;
  IRCodes["Back Button"]          = 16750695;
  IRCodes["EQ Button"]            = 16769055;
  IRCodes["USD Button"]           = 16756815;

  //Media Keys
  IRCodes["PlayPause Button"]     = 16720605;
  IRCodes["Rewind Button"]        = 16712445;
  IRCodes["Fast Forward Button"]  = 16761405;

  //Volume Keys
  IRCodes["Mute Button"]          = 16769565;
  IRCodes["Minus Button"]         = 16754775;
  IRCodes["Plus Button"]          = 16748655;

  //Numpad Keys
  IRCodes["Numpad 0"]             = 16738455;
  IRCodes["Numpad 1"]             = 16724175;
  IRCodes["Numpad 2"]             = 16718055;
  IRCodes["Numpad 3"]             = 16743045;
  IRCodes["Numpad 4"]             = 16716015;
  IRCodes["Numpad 5"]             = 16726215;
  IRCodes["Numpad 6"]             = 16734885;
  IRCodes["Numpad 7"]             = 16728765;
  IRCodes["Numpad 8"]             = 16730805;
  IRCodes["Numpad 9"]             = 16732845;

  //Non-Key Codes
  IRCodes["Excess Communication"] = 4294967295;

}
</code></pre>

<p>Can someone explain what I'm doing wrong to me in terms that someone of my early C++ knowledge-base would understand?</p>