mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 06:02:14 +00:00
Add make_slice_helper factory function
[SVN r20373]
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/python/errors.hpp>
|
||||
#include <boost/python/suite/indexing/int_slice_helper.hpp>
|
||||
#include <boost/python/suite/indexing/slice.hpp>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#include <limits>
|
||||
@@ -65,9 +66,12 @@ namespace boost { namespace python { namespace indexing {
|
||||
static iterator begin (container &c) { return c.begin(); }
|
||||
static iterator end (container &c) { return c.end(); }
|
||||
|
||||
// Reasonable default for slice handling
|
||||
typedef int_slice_helper<self_type> slice_helper;
|
||||
// Reasonable defaults for slice handling
|
||||
typedef int_slice_helper<self_type, integer_slice> slice_helper;
|
||||
|
||||
static slice_helper make_slice_helper (container &c, slice const &);
|
||||
|
||||
// Default visitor_helper
|
||||
template<typename PythonClass, typename Policy>
|
||||
static void visitor_helper (PythonClass &, Policy const &);
|
||||
|
||||
@@ -405,6 +409,18 @@ namespace boost { namespace python { namespace indexing {
|
||||
std::sort (begin(c), end(c));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// slice_helper factory function (default version)
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename ContainerTraits>
|
||||
typename default_algorithms<ContainerTraits>::slice_helper
|
||||
default_algorithms<ContainerTraits>
|
||||
::make_slice_helper (container &c, slice const &sl)
|
||||
{
|
||||
return slice_helper (c, integer_slice (sl, size (c)));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Visitor helper function (default version)
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user