I am implementing a container like:
template<typename T>
class Container
{
public:
using value_type = T;
...
};
Is there a good way to derive a const value_type
from const Container
?
Background:
I have implemented iterator types via a nested template class:
template<typename Container, typename Value>
class iterator_base
{
public:
...
Value& operator*() const;
private:
Container* c;
};
using iterator = iterator_base<Container, value_type>;
using const_iterator = iterator_base<const Container, const value_type>;
which works okay, but the second template argument to iterator_base
feels redundant.