
Artyom wrote:
Is there any way to set default argument values with Boost::Function? On VS2008 SP1 I tried:
boost::function< void( unsigned i = 1 ) > increment;
But this didn't work.
I don't think this is possible with boost::function. That reminds me
Boost.Overload, which was discussed some time ago on the developers
mailing list. There's something in the sandbox:
https://svn.boost.org/trac/boost/browser/sandbox/overload/trunk/libs/ove
rload but I'm not aware of its status.
A quick and dirty alternative may be something like:
namespace bft = boost::function_types;
namespace bmpl = boost::mpl;
template<
typename FuncT,
typename bmpl::at
::type DefaultArg
struct UnaryFuncWithDefault
{
typedef typename bft::result_type<FuncT>::type ResultType;
typedef typename bmpl::at