C++ map with custom comparator not inserting all elements : <p>I have created the following comparator to test the map:</p>

<pre><code>struct comparator{
    bool operatior() (int a,int b){
        return 1;
    }
}
</code></pre>

<p>then the following algorthim:</p>

<pre><code>int main(){
    // imports string to currentString
       ...
    std::map&lt;int,char&gt; default_map;
    std::map&lt;int,char,comparator&gt; test_map;

    while(i &lt; stringSize){
       if(currentString[i] == '(' || currentString[i] == ')'){
          default_map[i]=currentString[i];
          test_map[i]=currentString[i];
       }
    }

    auto currentIterator = default_map.begin();
    while(currentIterator != default_map.end()){
        printf("%d %c\n",currentIterator-&gt;first,currentIterator-&gt;second);
    }

    auto currentIterator = test_map.begin();
    while(currentIterator != test_map.end()){
         printf("%d %c\n",currentIterator-&gt;first,currentIterator-&gt;second);
    }

    return 0;
}
</code></pre>

<p>Here the default_map prints all of the parenthesis, while the test_map with the custom comparitor only prints the first two parenthesis.</p>

<p>Is this a bug in the map code?
I originally wanted to have class as the key with a custom comparator, but it isn't even working with a custom int key.</p>

<p>My make file does use the -std=c++1y tag so maybe that is effecting it?
I don't know what to do. I am considering to see if the SGI map will work better than the std one.</p>
