I have the following:
#include<iostream>
#include<unordered_map>
#include<tuple>
using namespace std;
class CTest {
// Properties
public:
unordered_map<const string, tuple<int, int> > Layout;
// Methods
public:
CTest ();
~CTest ();
};
CTest::CTest () {
Layout["XYZ"] = make_tuple (0, 1);
}
CTest::~CTest () {
// Do nothing
}
int main (int argc, char *argv[]) {
CTest Test;
return 0;
}
Compiling this simple programme gives the following error:
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'const std::string' (or there is no acceptable conversion)
I'm using Visual Studio 2010 Professional in Windows 7.
In addition to changing Layout
to:
unordered_map<string, tuple<int, int> > Layout;
as stated by Johan and Benjamin you also need to #include <string>
.
Note, I do not understand why the change to Layout
is required, even if the const
is superfluous.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With