This error is thrown when comparing a shared_ptr to NULL. To resolve
this we just use shared_ptr::operator bool that checks if the stored
pointer is null.
In C++11 the shared_ptr can be compared to nullptr, but as of yet I have
not come up with a good compatibility fix.
Details:
os/MemStore.cc:259:30: error: use of overloaded operator '!=' is ambiguous (with operand types 'ObjectRef' (aka 'shared_ptr<MemStore::Object>') and 'long')
return (c->get_object(oid) != __null);
~~~~~~~~~~~~~~~~~~ ^ ~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4787:1: note: candidate function [with _Tp = MemStore::Object]
operator!=(const shared_ptr<_Tp>& __x, nullptr_t) throw()
^
os/MemStore.cc:259:30: note: built-in candidate operator!=(int, long)
return (c->get_object(oid) != __null);
^
os/MemStore.cc:259:30: note: built-in candidate operator!=(unsigned __int128, long)
os/MemStore.cc:259:30: note: built-in candidate operator!=(unsigned long long, long)
.....
1 error generated.
make[3]: *** [os/MemStore.lo] Error 1
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
return false;
RWLock::RLocker l(c->lock);
- return (c->get_object(oid) != NULL);
+ // Perform equivalent of c->get_object_(oid) != NULL. In C++11 the
+ // shared_ptr needs to be compared to nullptr.
+ return (bool)c->get_object(oid);
}
int MemStore::stat(