List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:November 7 2005 8:03pm
Subject:Re: Mysql++ and stl bitset class.
View as plain text  
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 

Good luck with this new project you've volunteered for.  We're all 
rooting for you.  :)
Mysql++ and stl bitset class.Jonatan Taminau7 Nov
  • RE: Mysql++ and stl bitset class.Steve Povilaitis7 Nov
  • Re: Mysql++ and stl bitset class.Warren Young7 Nov