$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-12-05 10:35:08
#include <boost/static_assert.hpp>
#include <cstddef>
// Computes (at compile-time) the number of elements that a Python
// argument tuple must have in order to be passed to a wrapped C++
// (member) function of the given type.
typedef char (&a1) [1];
typedef char (&a2) [2];
template<class R> a1 f(R (*)());
template<class R, class T> a2 f(R (T::*)());
template <class F> struct arg_tuple_size
{
enum { value = sizeof(f(F())) - 1 };
};
struct X
{
};
int main()
{
typedef void (X::*pmf_type)();
enum { v = arg_tuple_size<pmf_type>::value };
BOOST_STATIC_ASSERT(v == 1);
return 0;
}
-- Peter Dimov Multi Media Ltd.