[odb-users] ODB Support for Boost dynamic_bitset

Boris Kolpackov boris at codesynthesis.com
Thu Oct 17 00:47:56 EDT 2013

Hi Jiemin,

Huang Jiemin <hjiemin at dso.org.sg> writes:

> I'm new to ODB and I would like to find out if ODB supports Boost
> dynamic_bitset to any type in MS SQL? I couldn't find any information
> on dynamic_bitset in the documentation.

There is no built-in support for boost::dynamic_bitset. I guess the
most natural database type to map it to is BINARY/BLOB. You can
easily implement this mapping yourself as explained in this article:


If you want a quick a dirty solution, then you can map it to string
in the database with a help of a virtual data member, for example:

#pragma db object
class object

  #pragma db transient
  boost::dynamic_bitset<> data_;

  data_as_string () const
    std::string s;
    boost::to_string (data_, s);
    return s;

  data_from_string (const std::string& s)
    data_ = boost::dynamic_bitset<> (s);

  #pragma db member(data) virtual(std::string) \
    get(data_as_string) set(data_from_string)


More information about the odb-users mailing list