template dereference of an iterator

How can I dereference a template iterator to its value type?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
template<typename It, typename CIt = const It>
struct iterator_reference_subcontainer
{
	typedef declspec(typename It::operator*()) value_type;    // <----HERE!!!
	typedef size_t size_type;
	typedef It iterator;
	typedef CIt const_iterator;
	...........
	//! Get a reference \p idx -th element.
	value_type &operator[](size_type idx) { return f[idx]; }
	//! Get \p idx -th element.
	value_type operator[](size_type idx) const { return f[idx]; }

protected:
	iterator f, l;	// !< Iterators to first and last container elements. 
typedef typename std::iterator_traits<It>::value_type value_type;
I hope by "declspec" you mean "decltype", in which case it might have worked - but I suggest Cubbi's solution as it is correct.
Topic archived. No new replies allowed.