## Integration with Boost The SOCI user code can be easily integrated with the [Boost library](http://www.boost.org/) thanks to the very flexible type conversion facility. There are three important Boost types that are supported out of the box. ####boost::optional `boost::optional` provides an alternative way to support the null data condition and as such relieves the user from necessity to handle separate indicator values. The `boost::optional` objects can be used everywhere where the regular user provided values are expected. Example: boost::optional name; sql << "select name from person where id = 7", into(name); if (name.is_initialized()) { // OK, the name was retrieved and is not-null cout << "The name is " << name.get(); } else { // the name is null } The `boost::optional` objects are fully supported for both `into` and `use` elements, in both single and vector forms. They can be also used for user-defined data types. ####boost::tuple `boost::tuple` allows to work with whole rows of information and in some cases can be more convenient to use than the more dynamically-oriented `row` type. boost::tuple person; sql << "select name, phone, salary from persons where ...", into(person); Tuples are supported for both `into` and `use` elements. They can be used with `rowset` as well. Tuples can be also composed with `boost::optional` boost::tuple, int> person; sql << "select name, phone, salary from persons where ...", into(person); if (person.get<1>().is_initialized()) { // the given person has a phone number } else { // this person does not have a phone number } ####boost::fusion::vector The `boost::fusion::vector` types are supported in the same way as tuples. ####boost::gregorian::date The `boost::gregorian::date` is provided as a conversion for base type `std::tm` and can be used as a replacement for it. --- #####Optional integration: The integration with Boost types is optional and *not* enabled by default, which means that SOCI can be compiled and used without any dependency on Boost. --- In order to enable the support for any of the above types, the user needs to either include one of these headers: #include #include #include #include or to define the `SOCI_USE_BOOST` macro before including the `soci.h` main header file. Note that in this case the support for `boost::fusion::vector` is enabled only if the detected Boost version is at least 1.35.