Typical boiler types for a container compatible with STL

Does the standard library or Boost have some kind of base utility class for populating a custom STL-compatible sequence with the required typedefs (size_type, value_type, etc.). I am thinking of something like boost :: iterator_facade , but for containers.

I was about to curl up, but I wanted to make sure that this did not exist.

UPDATE:

This is the base utility class I came across in case anyone finds this useful:

template <class C>
class ContainerAdapter
{
public:
    typedef C::value_type value_type;
    typedef C::reference reference;
    typedef C::const_reference const_reference;
    typedef C::const_iterator iterator;
    typedef C::const_iterator const_iterator;
    typedef C::difference_type difference_type;
    typedef C::size_type size_type;

protected:
    typedef C::container_type;
};


// Usage
class MyCustomContainer : public ContainerAdapter< std::vector<int> >
{
...
};

The ContainerAdapter simply β€œechoes” the nested typedefs of the container underlying the container. Nothing really.

+5
1

, typedef typename base::size_type size_type. , .

+1

All Articles