Boost logo

Boost Users :

From: Joel de Guzman (joel_at_[hidden])
Date: 2007-08-14 19:17:56


Noah Roberts wrote:
> I am trying to generalize the concept of putting database data into
> boost::tuple objects. I'm thinking syntax similar to something like so:
>
> typedef boost::tuple<int, double, std::string> row;
>
> row r = SqlQuery<row>::run_query(db, "select * from x");
>
> I imagine something like so being contained in the processing:
>
> TUPLE t;
> ...
> t.get<X>() = boost::lexical_cast< typename
> boost::tuples::element<X,TUPLE>::type >(data[X]); // data is char **
>
> Where X is the index of the element and the entire tuple is iterated in
> this manner. I thought maybe there would be something in MPL that could
> help but I'm not seeing it.
>
> Anyone got any bright ideas?

Seems like Fusion is your friend here :-)

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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