开发者

std::vector, element pointer and input interator

开发者 https://www.devze.com 2023-04-08 09:35 出处:网络
I don\'t have my copy of Meyer\'s Effective C++ with me, so please forgive the question. template <class InputIterator>

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

精彩评论

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