Imagine that you are creating a wrapper around some SQL database interface. You decided that
boost::any will perfectly match the requirements for a single cell of the database table. Some other programmer will be using your classes, and his task would be to get a row from the database and count the sum of the arithmetic types in a row.
Here's how the code would look:
#include <boost/any.hpp> #include <vector> #include <string> #include <typeinfo> #include <algorithm> #include <iostream> // This typedefs and methods will be in our header, // that wraps around native SQL interface typedef boost::any cell_t; typedef std::vector<cell_t> db_row_t; // This is just an example, ...