stdcpp/tsrc/Stdcpp_test/stlport/auto/stlport_iter/src/iter3.cpp
changeset 31 ce057bb09d0b
child 34 5fae379060a7
equal deleted inserted replaced
30:e20de85af2ee 31:ce057bb09d0b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17  
       
    18 // STLport regression testsuite component.
       
    19 // To compile as a separate example, please #define MAIN.
       
    20 
       
    21 #include <iostream>
       
    22 #include <vector>
       
    23 #include <algorithm>
       
    24 
       
    25 #ifdef MAIN 
       
    26 #define iter3_test main
       
    27 #endif
       
    28 
       
    29 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
       
    30 using namespace std;
       
    31 #endif
       
    32 
       
    33 int iter3_test(int, char**)
       
    34 {
       
    35   cout<<"Results of iter3_test:"<<endl;
       
    36   typedef vector<const char*> Vec;
       
    37     const char* array[2];
       
    38   int j =0 ;
       
    39   int failures = 0;
       
    40   Vec v; // Vector of character strings.
       
    41   v.push_back((char*) "zippy"); // First element.
       
    42   v.push_back((char*) "motorboy"); // Second element.
       
    43   Vec::reverse_iterator it;
       
    44   for(it = v.rbegin(); it != v.rend(); it++)
       
    45   {
       
    46   	    cout << *it << endl; // Display item.
       
    47   	    array[j++] = *it;
       
    48   }
       
    49       
       
    50   
       
    51   if(array[0] != "motorboy")
       
    52   failures++;
       
    53    if(array[1] != "zippy")
       
    54   failures++;
       
    55   
       
    56   return failures;
       
    57 }