$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Sohail Somani (s.somani_at_[hidden])
Date: 2007-01-21 20:08:57
Hi,
(CC'ing Peter and Joel)
I've developed a patch after a somewhat short discussion on the users list for adding the ability to determine the number of arguments required at minimum for a bind expression. It is developed as a non-intrusive patch to bind and fusion. Basic usage is as follows:
#include <boost/bind/min_arity.hpp>
template<typename BindExpression>
void dispatch(BindExpression const & e,boost::mpl::int_<0>)
{
// callable as e()
}
template<typename BindExpression>
void dispatch(BindExpression const & e,boost::mpl::int_<1>)
{
// callable as e(_bi::type_at_index<arg_sequence,1>::type)
}
template<typename BindExpression>
void fn(BindExpression e)
{
typedef boost::min_arity<BindExpression::type min_arity;
dispatch(e,min_arity());
]
The patch is at:
http://sohail.taggedtype.net/software/bind_arg_sequence_patch.tar.bz2
To apply:
cd /path/to/boost/root
tar -xjvf /path/to/bind_arg_sequence_patch.tar.bz2
patch -p0 < bind_arg_sequence.patch
I would appreciate any comments. Currently it lacks documentation and I think the generated specializations could stand to be renamed. If you would like me to go further, please let me know.
Thank you,
Sohail