[Libpqxx-general] Tablewriter: entering specified fields only

Robert Backhaus-pqxx pqxx at robbak.com
Fri May 22 02:35:46 UTC 2009


On Fri, May 22, 2009 at 7:57 AM, Jeroen Vermeulen <jtv at xs4all.nl> wrote:

> Matthew Fanto wrote:
>
>  I think the idea is you want to create a container of the column names.
>> You
>>
>
> That's right.  This is a common idiom in the C++ standard library, but I
> overlooked the possibility that someone might misunderstand and pass two
> column names instead, and that this would compile but probably crash. I'll
> try to make sure that code like this fails to compile with a somewhat
> informative error message.
>
>
> Jeroen


Thank you. I have implemented it pretty much as per Matthew's example
(thanks, your pseudo code was in fact very good code!) and it works well.
As this is a reasonably common usage of the library, might a test exercising
it be a good idea? I did check the tests, but the only one (test005.cxx)
that uses these arguments didn't (then) make a lot of sense to me
(std::string column="data"; tablewriter W(....,&column, &column+1); )
It makes some sense to me now, but still looks a little weird! It also
refers to the only column in the created table, and used a string, so it
didn't do much to remove my confusion. ( I did also try std::string
columnfirst "name"; std::string columnlast "othername"; tablewriter
W(....,columnfirst, columnlast);, and various other things - I was trying!)
Anyway, thank you very much for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/libpqxx-general/attachments/20090522/4a8e632c/attachment.html 


More information about the Libpqxx-general mailing list