What's the best way to check if an (optional) argument has been passed? One way is to use a default value, but I wonder if there is a tidier approach

Thanks.

(For startDate and endDate below)

struct NanoClientOptions
{
        string nanoUrl="tcp://127.0.0.1:9999";
        string[] tickers;
        DateTime startDate=DateTime(1,1,1);
        DateTime endDate=DateTime(9999,1,1);
}

auto helpInformation = getopt(
    args,
"nanoUrl", "Address of kaleidic data nanoserver eg tcp://127.0.0.1:9999", &options.nanoUrl, std.getopt.config.required, "ticker|t", "Tickers to download data for", &options.tickers,
            "startDate|s", "Start Date",                                    
&options.startDate,
            "endDate|e",       "End Date",                                  
&options.endDate
            );

Laeeth

Reply via email to