[gdal-dev] Optional Arguments in Function

Matthew Denno mgdenno at gmail.com
Mon Jan 11 16:09:45 EST 2010


Hello,

I have a question about writing a function which uses OGR and I am
hoping someone can point me in the right direction.

I am trying to write a function that takes a few OGRFeatures as
arguments.  However I want one of them to be optional.  I was hoping
to do something like the following but it does not appear to be valid:

int add_to_dt(OGRFeature &inputFeature, OGRFeature &optionalMask = NULL)
{
      if ( ! optionalMask == NULL)
      {
            //use mask
      }
      else
      {
            //don't use mask
      }
}

What would be the proper way to do something like this?

Thanks,

Matt


More information about the gdal-dev mailing list