[C++-sig] Providing a default value for a pointer argument

David Abrahams dave at boost-consulting.com
Wed Mar 22 16:16:46 CET 2006


Matthias Baas <baas at ira.uka.de> writes:

> Hi,
>
> I have a question about the "arg" class which can be used to provide 
> names for keyword arguments and their default values. Should this 
> default value also be taken into account for arguments that are actually 
> pointers?
> I have a function that takes a pointer as input whose default value in C 
> is 0. When I wrap that function I provide the default value as 
> arg("...")=0. 

Try 

   arg("...") = object()

object() produces a None, and None is the canonical object that's
convertible to NULL pointers.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list