Пример #1
0
 // Extract an object x of the Target type from the first Python
 // argument, and invoke get_start(x)/get_finish(x) to produce
 // iterators, which are used to construct a new iterator_range<>
 // object that gets wrapped into a Python iterator.
 iterator_range<NextPolicies,Iterator>
 operator()(back_reference<Target&> x) const
 {
     // Make sure the Python class is instantiated.
     detail::demand_iterator_class("iterator", (Iterator*)0, NextPolicies());
     
     return iterator_range<NextPolicies,Iterator>(
         x.source()
       , m_get_start(x.get())
       , m_get_finish(x.get())
     );
 }
Пример #2
0
 static object
 base_get_item(back_reference<Container&> container, PyObject* i)
 { 
     if (PySlice_Check(i))
         return slice_handler::base_get_slice(
             container.get(), reinterpret_cast<PySliceObject*>(i));
     
     return proxy_handler::base_get_item_(container, i);
 }
Пример #3
0
// prove that back_references contain the right value
bool y_equality(back_reference<Y const&> y1, Y const& y2)
{
    return &y1.get() == &y2;
}