3 messages in com.mysql.lists.plusplusRe: Mysql++ and stl bitset class.
FromSent OnAttachments
Jonatan Taminau07 Nov 2005 05:27 
Steve Povilaitis07 Nov 2005 06:52 
Warren Young07 Nov 2005 12:02 
Subject:Re: Mysql++ and stl bitset class.
From:Warren Young (mysq@etr-usa.com)
Date:11/07/2005 12:02:38 PM
List:com.mysql.lists.plusplus

Jonatan Taminau wrote:

However, I should be able to do this in a more performant way without the 'string-conversion'.

How many bits do you have?

If it is less than or equal to the size in bits of your platform's unsigned long type, the solution is easy: use bitset::to_ulong(), and just store the value in an integer column.

If it is more than that, you will have a much slower solution (though faster than to_string()). You will have to use count() and iterate over the "container" calling test() on each bit to construct your own binary representation. There seems to be no direct way to extract the data in the internal binary representation; this is probably A Feature (TM).

To keep this relevant to the mailing list, I invite you to work out an adapter of some sort to do it both ways, for use with MySQL++'s SSQLS feature.

Good luck with this new project you've volunteered for. We're all rooting for you. :)