开发者

std::vector, element pointer and input interator

I don't have my copy of Meyer's Effective C++ with me, so please forgive the question.

template <class InputIterator>
    void insert ( iterator position, InputIterator first, InputIterator last );

For vector's insert, is a byte* to a raw memory block a valid InputIterat开发者_Go百科or?

typedef unsigned char byte;
vector<byte> my_vector;

byte my_data[NNN];
const byte* first = my_data;
const byte* last = my_data + COUNTOF(my_data);

my_vector.insert(my_vector.end(), first, last);


Yes, a pointer is an input iterator.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜