2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-24 06:02:14 +00:00

implemented list.sort with keyword argument support, by using args_proxy and kwds_proxy. Not a nice solution though...

[SVN r55078]
This commit is contained in:
Haoyu Bai
2009-07-22 05:38:59 +00:00
parent e428495a96
commit 7bf964b1ce
4 changed files with 23 additions and 3 deletions

View File

@@ -37,8 +37,12 @@ namespace detail
void reverse(); // reverse *IN PLACE*
void sort(); // sort *IN PLACE*; if given, cmpfunc(x, y) -> -1, 0, 1
#if PY_VERSION_HEX >= 0x03000000
void sort(args_proxy const &args,
kwds_proxy const &kwds);
#else
void sort(object_cref cmpfunc);
#endif
protected:
list_base(); // new list
@@ -113,13 +117,15 @@ class list : public detail::list_base
base::remove(object(value));
}
#if PY_VERSION_HEX <= 0x03000000
void sort() { base::sort(); }
template <class T>
void sort(T const& value)
{
base::sort(object(value));
}
#endif
public: // implementation detail -- for internal use only
BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(list, base)