Boost logo

Boost Users :

Subject: [Boost-users] boost fusion and/or boost parameter: open ended question about constructing object from a string
From: e r (erwann.rogard_at_[hidden])
Date: 2008-09-10 00:00:21


hi,

here's what i'd like to do

A]

hpp:

struct my{
         template<typename ArgPack>
        my(const ArgPack& args):n_(args[tag::n]),k_(args[tag::k]){}
}

struct argpack{
  arglist<???> operator()(const string& str){???}
}

cpp:

string str("n=2; k=1");

my(argpack(str));

In words,I'm looking to construct an ArgPack from a string, what's the
appropriate library for this? Does it seem like I should invest in Boost
Spirit?

B]

The above is a simplified version of what i really need, which is,
potentially,
1) having to construct a large number of objects (to be pushed at the
back of a container)
2) each object taking a large number arguments (not just n and k as above)
3) each object an instance of one of a set of classes
(my0,my1,my2,...,myN) each with its specific argument tags (keywords).

So I'd like to put all these arguments in a file, each line
corresponding to an object, rather than have a messy cpp file.

this is all very open-ended, but so reads the subject title...

thanks!


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