mirror of
https://github.com/boostorg/python.git
synced 2026-02-01 08:42:16 +00:00
mapping suite update
[SVN r19598]
This commit is contained in:
@@ -98,7 +98,7 @@ namespace boost { namespace python { namespace detail {
|
||||
{
|
||||
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
|
||||
// Erase the proxy with index i
|
||||
replace(i, i, 0);
|
||||
replace(i, i+1, 0);
|
||||
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
|
||||
}
|
||||
|
||||
@@ -109,9 +109,14 @@ namespace boost { namespace python { namespace detail {
|
||||
// Erase the proxy with index i
|
||||
|
||||
iterator iter = first_proxy(i);
|
||||
if (iter != proxies.end()
|
||||
&& extract<Proxy&>(*iter)().get_index() == i)
|
||||
extract<Proxy&> p(*iter);
|
||||
|
||||
if (iter != proxies.end() && p().get_index() == i)
|
||||
{
|
||||
extract<Proxy&> p(*iter);
|
||||
p().detach();
|
||||
proxies.erase(iter);
|
||||
}
|
||||
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
|
||||
}
|
||||
|
||||
@@ -215,6 +220,17 @@ namespace boost { namespace python { namespace detail {
|
||||
"Invariant: Proxy vector in an inconsistent state");
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
if (i+1 != proxies.end())
|
||||
{
|
||||
if (extract<Proxy&>(*(i+1))().get_index() ==
|
||||
extract<Proxy&>(*(i))().get_index())
|
||||
{
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
"Invariant: Proxy vector in an inconsistent state (duplicate proxy)");
|
||||
throw_error_already_set();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -64,30 +64,32 @@ namespace boost { namespace python {
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::difference_type difference_type;
|
||||
|
||||
// template <class Class>
|
||||
// static void
|
||||
// extension_def(Class& cl)
|
||||
// {
|
||||
template <class Class>
|
||||
static void
|
||||
extension_def(Class& cl)
|
||||
{
|
||||
// cl
|
||||
// .def("append", &base_append)
|
||||
// .def("extend", &base_extend)
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
|
||||
static data_type&
|
||||
get_item(Container& container, index_type i_)
|
||||
{
|
||||
typename Container::iterator i = container.find(i_);
|
||||
key_check(container, i);
|
||||
if (i == container.end())
|
||||
{
|
||||
PyErr_SetString(PyExc_KeyError, "Invalid key");
|
||||
throw_error_already_set();
|
||||
}
|
||||
return i->second;
|
||||
}
|
||||
|
||||
static void
|
||||
set_item(Container& container, index_type i_, data_type const& v)
|
||||
set_item(Container& container, index_type i, data_type const& v)
|
||||
{
|
||||
typename Container::iterator i = container.find(i_);
|
||||
key_check(container, i);
|
||||
i->second = v;
|
||||
container[i] = v;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -133,18 +135,6 @@ namespace boost { namespace python {
|
||||
throw_error_already_set();
|
||||
return index_type();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static void
|
||||
key_check(Container& container, typename Container::iterator i)
|
||||
{
|
||||
if (i == container.end())
|
||||
{
|
||||
PyErr_SetString(PyExc_KeyError, "Invalid key");
|
||||
throw_error_already_set();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
Reference in New Issue
Block a user