(C++98, gcc4.4.7) Let's say I have a database-connected container that does not provide iterators over itself, but only an indexed getter and size(), ex:
template<typename T>
class DbVector
{
public:
const T& getValue(const size_t) const;
size_t size() const;
};
I'd like to be able to use it in range-based algorithms. This sounds like a common problem. Does Boost provide a solution for this?
I've looked a bit into Boost.Iterator and Boost.Range, but with no success. I'm not even sure how my google query should be formulated to find anything useful.
I thought maybe there is a library, that would allow something like:
typedef Iterable<DbVector<int>,
&DbVector<int>::getValue,
&DbVector<int>::size>
IterableDbVectorInt;
const DbVector<int>& dbVector = getDbVector();
return boost::any_of_equal(IterableDbVectorInt(dbVector), someValue);
I know I could write it myself from scratch, but I'm really trying not to reinvent the wheel.
Any boost-based ideas?