c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/modernize-loop-convert.cpp
branchrelease82
changeset 18423 b9d9af239a0c
parent 18403 67d78b11d2e0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/modernize-loop-convert.cpp	Wed Jun 07 20:23:29 2017 +0300
     1.3 @@ -0,0 +1,25 @@
     1.4 +#include <vector>
     1.5 +#include <iostream>
     1.6 +
     1.7 +using namespace std;
     1.8 +
     1.9 +int loops() {
    1.10 +    const int N = 5;
    1.11 +    int arr[] = {1, 2, 3, 4, 5};
    1.12 +    vector<int> v;
    1.13 +    v.push_back(1);
    1.14 +    v.push_back(2);
    1.15 +    v.push_back(3);
    1.16 +
    1.17 +    // safe conversion
    1.18 +    for (int i = 0; i < N; ++i)
    1.19 +        cout << arr[i];
    1.20 + 
    1.21 +    // reasonable conversion
    1.22 +    for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)
    1.23 +        cout << *it;
    1.24 +
    1.25 +    // reasonable conversion
    1.26 +    for (int i = 0; i < v.size(); ++i)
    1.27 +        cout << v[i];
    1.28 +}    
    1.29 \ No newline at end of file