fogbit
fogbit

Reputation: 2063

iterator type for primitive type arrays

std::copy<InputInterator, OutputIterator>( /*...*/ );

How to determine InputInterator and OutputIterator types for an array of doubles double d[]? Is there some kind of iterator_traits<double*>::iterator_type?

upd: i use very old compiler, so i need explicit instantiation

Upvotes: 1

Views: 907

Answers (1)

ForEveR
ForEveR

Reputation: 55897

Why you need this? copy is a function, so, use simply

std::copy(d, d + size, d);

This call will automatically deduce the types of arguments.

And also, there is std::iterator_traits<T*>::pointer, that evaluates for double* as double* and you can simply use

std::copy<double*, double*>(d, d + size, d);

if you want.

Upvotes: 2

Related Questions