template<class Type> struct iterator_traits<const Type*>

T

Taras_96

Hi everyone,

I came across the following:

" * There is also a third version for pointers to const to remove
the const from the value type.

template <class T>
struct iterator_traits<const T*> {
typedef T value_type;
};
" - http://www.cs.helsinki.fi/u/tpkarkka/alglib/k06/lectures/iterators.html#other-associated-types

However, the site at http://msdn2.microsoft.com/en-us/library/zdxb97eh(VS.71).aspx
shows that:

"template<class Type>
struct iterator_traits<const Type*> {
typedef random_access_iterator_tag iterator_category;
typedef Type value_type;
typedef ptrdiff_t difference_type;
typedef const Type *pointer;
typedef const Type& reference;
};" (ie: the const is in the typedef)

Which one is correct?

Thanks

Taras
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top