From 536ef11ccef7395ab4a384e2598fc6c588c0bb3a Mon Sep 17 00:00:00 2001 From: Raoul Gough Date: Tue, 14 Oct 2003 11:18:49 +0000 Subject: [PATCH] Add make_slice_helper factory function [SVN r20373] --- .../python/suite/indexing/algorithms.hpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/include/boost/python/suite/indexing/algorithms.hpp b/include/boost/python/suite/indexing/algorithms.hpp index 24d8e7c1..1e0a27f9 100755 --- a/include/boost/python/suite/indexing/algorithms.hpp +++ b/include/boost/python/suite/indexing/algorithms.hpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -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 slice_helper; + // Reasonable defaults for slice handling + typedef int_slice_helper slice_helper; + static slice_helper make_slice_helper (container &c, slice const &); + + // Default visitor_helper template 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 default_algorithms::slice_helper + default_algorithms + ::make_slice_helper (container &c, slice const &sl) + { + return slice_helper (c, integer_slice (sl, size (c))); + } + ///////////////////////////////////////////////////////////////////////// // Visitor helper function (default version) /////////////////////////////////////////////////////////////////////////