EDITED more code that reproduces the error, changed map to unordered_map.
I've been away and coding pure objective C for over a year now so please forgive me if this is a newbie mistake!
I'm compiling as .mm (Objective-C++) in XCode 5 targeting iOS 7 simulator. It uses clang-503.0.40. based on LLVM 3.4.
Here's the code:
typedef uint32_t uint32;
class Actor {
public:
std::string name;
std::set<uint32> behaviors;
Actor() { }
private:
};
class Location {
public:
// .. some stuff ...
std::unordered_map<uint32,std::shared_ptr<Actor>> actors; // A list of actors in the location
Location() { }
private:
};
Then in a function I do -
std::shared_ptr<Location> l1(new Location);
std::shared_ptr<Actor> npc(new Actor);
l1->actors.emplace(npc); // ERROR HAPPENS HERE
I changed it to an unordered map since I couldn't provide a "less" and don't need ordering.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/unordered_map:544:11: No matching constructor for initialization of 'value_type' (aka 'pair')
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/memory:1641:31: In instantiation of function template specialization 'std::__1::__hash_value_type >::__hash_value_type &>' requested here
There's a whole long chain of candidate constructors that were ruled out and other things like that if you need to see them.
So what newbie mistake am I making?