mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 06:02:14 +00:00
avoid use of sizeof to enable compilation with buggy gcc 3.3; change as per David Abrahams' instructions
[SVN r18549]
This commit is contained in:
@@ -19,16 +19,13 @@ struct as_to_python_function
|
||||
// the first overload ensures it isn't used in case T is a
|
||||
// reference.
|
||||
template <class U>
|
||||
static int convert_function_must_take_value_or_const_reference(U(*)(T), int, T* = 0);
|
||||
static void convert_function_must_take_value_or_const_reference(U(*)(T), int, T* = 0) {}
|
||||
template <class U>
|
||||
static int convert_function_must_take_value_or_const_reference(U(*)(T const&), long ...);
|
||||
static void convert_function_must_take_value_or_const_reference(U(*)(T const&), long ...) {}
|
||||
|
||||
static PyObject* convert(void const* x)
|
||||
{
|
||||
BOOST_STATIC_ASSERT(
|
||||
sizeof(
|
||||
convert_function_must_take_value_or_const_reference(&ToPython::convert, 1L))
|
||||
== sizeof(int));
|
||||
convert_function_must_take_value_or_const_reference(&ToPython::convert, 1L);
|
||||
|
||||
// Yes, the const_cast below opens a hole in const-correctness,
|
||||
// but it's needed to convert auto_ptr<U> to python.
|
||||
|
||||
Reference in New Issue
Block a user