#include <vector>
#include <iostream>
using namespace std;
template <class T>
void print(T& c){
for( typename T::iterator i = c.begin(); i != c.end(); i++ ){
std::cout << *i << endl;
}
}
int main( )
{
const int num_elements = 5;
const float value = 3.14f;
// construct a vector filled with copies of one value
vector<float> v( num_elements, value );
print( v);
}
|