Boost logo

Boost Users :

Subject: [Boost-users] Question about Program Options Vector processing for config file
From: Charles Mills (charlesm_at_[hidden])
Date: 2012-07-05 14:22:46


I have the following in my code

cnfOptions->add_options()("pacing", po::value< std::vector<float>
>(&foo)->composing(), "Pacing experiment")

If my config file contains

pacing= 3.14
pacing= 2.718

then it works as expected (foo contains the two float numbers). But "pacing"
is really a pair of values, not some collection of independent values. I've
tried to find a config file syntax more like

pacing= 3.14 2.718

that Boost PO will accept, but I can't find one. (I get syntax error
complaints about pacing.)

Is there either (a.) a syntax for a single pacing= that PO will "compose"
into the vector, or (b.) a change I could make to add_options that would
make this work. For example, I'm not in love with vector if there is some
other container that would work better.

Thanks,
Charles


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