From the doc, it seems that shared_ptr would be considered a Chained Pointer, and as such should work as-is, which by that I mean that I
Hi. I'm trying to use a shared_ptr as the value_type of a
multi_index_container, but I'm not having any success with the key
extractors (VS2005, 1.38).
think I should be able to use the built-in key extractors whether
value_type is a value or a shared_ptr. But I'm not having any luck. I
found [1] which is very similar and which JoaquĆn answered, but I have
other key extractors I want to use in different indexes, so I don't
think using identity<> is applicable to my case in general, although
it would be in this one. I'm trying to avoid having to write dumb
custom key extractors for Foo, which would basically replicate what
the built-in ones do in the first place.
It's most likely an error an my part, but I can't spot it. Can someone
please help? Thanks, --DD
[1] http://www.nabble.com/-multiindex--custom-key-extractor-problem-td20839161.h...
#include
FooIndex;
int main() { FooIndex index; shared_ptr<Foo> p_foo(new Foo); BOOST_ASSERT(index.insert(p_foo).second); return 0; }