18 :
public boost::python::def_visitor<overload_base_get_item_for_std_map<Container>>
20 typedef typename Container::value_type value_type;
21 typedef typename Container::value_type::second_type data_type;
22 typedef typename Container::key_type key_type;
23 typedef typename Container::key_type index_type;
28 cl.def(
"__getitem__", &base_get_item);
32 static boost::python::object
33 base_get_item(boost::python::back_reference<Container &> container,
PyObject *
i_)
35 namespace bp = ::boost::python;
37 index_type idx = convert_index(container.get(),
i_);
38 typename Container::iterator
i = container.get().find(idx);
39 if (
i == container.get().end())
42 bp::throw_error_already_set();
45 typename bp::to_python_indirect<data_type &, bp::detail::make_reference_holder> convert;
46 return bp::object(bp::handle<>(convert(
i->second)));
51 namespace bp = ::boost::python;
52 bp::extract<key_type const &>
i(
i_);
59 bp::extract<key_type>
i(
i_);
65 bp::throw_error_already_set();