mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
34 lines
776 B
C++
34 lines
776 B
C++
/****************************************************************
|
|
****
|
|
**** This file belongs with the course
|
|
**** Introduction to Scientific Programming in C++/Fortran2003
|
|
**** copyright 2017/8 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
***
|
|
**** rangemax.cxx : static array length examples
|
|
****
|
|
****************************************************************/
|
|
|
|
#include <iostream>
|
|
using std::cin;
|
|
using std::cout;
|
|
|
|
#include <vector>
|
|
using std::vector;
|
|
|
|
// is there a way to optimize the at function?
|
|
|
|
//int vector<int>::operator [](int i) { return this->at(i); };
|
|
|
|
template<>
|
|
int &vector<int>::at(int i) { return (*this)[i]; };
|
|
|
|
int main() {
|
|
|
|
//examplesnippet rangeout
|
|
vector<int> numbers = {1,4,2,6,5};
|
|
numbers[7] = 8;
|
|
//examplesnippet end
|
|
|
|
return 0;
|
|
}
|