I implement a container, for example:
template<typename T>
class Container
{
public:
using value_type = T;
...
};
Is there a good way to get const value_typeout const Container?
Background:
I implemented iterator types through 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 fine, but the second argument to the template iterator_baseseems redundant.
source
share