Boost logo

Boost Users :

Subject: [Boost-users] Unknown number of multitoken lists?
From: David Doria (daviddoria_at_[hidden])
Date: 2009-04-14 17:43:21


I want to do something like this:
--NumLists 2 --List0 a.txt b.txt --List1 c.txt d.txt

    vector<vector<string> > Lists(2);

    po::options_description desc("Allowed options");
    desc.add_options()
            ("help", "produce help message")
            ("List0", po::value<vector<string> >(&Lists[0])->multitoken(),
"List0.")
            ("List1", po::value<vector<string> >(&Lists[1])->multitoken(),
"List1.")
            ;

But if I wanted to handle --NumLists 10, I would have to manually add List0,
List1, ... List10 as parameters. That seems a bit silly, but maybe this is a
very odd usage? Please let me know if you can think of a better way to
handle this.

Thanks,

David



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net