
4 Dec
2011
4 Dec
'11
4:46 p.m.
Hi, which is the correct type used as index of operator[]. scoped_array uses std::ptrdiff_t. Others containers use std::size_t. The standard uses also std::size_t, but in 13.6 Built-in operators 13 For every cv-qualified or cv-unqualified object type T there exist candidate operator functions of the form T* operator+(T*, std::ptrdiff_t); T& operator[](T*, std::ptrdiff_t); T* operator-(T*, std::ptrdiff_t); T* operator+(std::ptrdiff_t, T*); T& operator[](std::ptrdiff_t, T*); we see again std::ptrdiff_t. When using an index to move from a scoped_array to another container which should be the type if the index? Best, Vicente