stdcpp/tsrc/Stdcpp_test/bcdrivers/tstl_4/src/tstl_4Blocks.cpp
changeset 22 ddc455616bd6
parent 0 e4d67989cc36
child 45 4b03adbd26ca
child 57 2efc27d87e1c
equal deleted inserted replaced
18:47c74d1534e1 22:ddc455616bd6
   363 
   363 
   364 
   364 
   365 int array1[10];
   365 int array1[10];
   366 int array2[10];
   366 int array2[10];
   367  list <int> L1;
   367  list <int> L1;
   368  list <int>::iterator LIter1, LIterend, LIterend2;
   368 // list <int>::iterator LIter1, LIterend, LIterend2;
   369 
   369 
   370  int t;
   370  int t;
   371  for ( t = 1 ; t <= 10 ; t++ )
   371  for ( t = 1 ; t <= 10 ; t++ )
   372  {
   372  {
   373     L1.push_back( t * t );
   373     L1.push_back( t * t );
   522  int myints1[]=
   522  int myints1[]=
   523  {
   523  {
   524  	10,20,30,40,50,60,70
   524  	10,20,30,40,50,60,70
   525  };
   525  };
   526 vector<int> myvector (myints,myints+8) ,myvector1(myints1,myints1+7);
   526 vector<int> myvector (myints,myints+8) ,myvector1(myints1,myints1+7);
   527 vector<int>::iterator it,it2; 
   527 vector<int>::iterator it; 
   528 //cout<<"";
   528 //cout<<"";
   529 #if  STDCPP_OOM
   529 #if  STDCPP_OOM
   530 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   530 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   531 
   531 
   532 #endif 
   532 #endif 
  1579 int array4[4] ={30,40,50,60  }; //not found iterator
  1579 int array4[4] ={30,40,50,60  }; //not found iterator
  1580 
  1580 
  1581 
  1581 
  1582 vector <int> v1(array1,array1+12), v2(array2,array2+3),v3(array3,array3+4);
  1582 vector <int> v1(array1,array1+12), v2(array2,array2+3),v3(array3,array3+4);
  1583   vector<int> v4(array4,array4+4);
  1583   vector<int> v4(array4,array4+4);
  1584   vector <int>::iterator Iter1, Iter2,Iter3 ,Iter4;
  1584 //  vector <int>::iterator Iter1, Iter2,Iter3 ,Iter4;
  1585 
  1585 
  1586 
  1586 
  1587   
  1587 vector <int>::iterator result1;
  1588 
  1588 
  1589  
  1589  	
  1590  vector <int>::iterator result1,result2; 
       
  1591  //cout<<"";
  1590  //cout<<"";
  1592  #if  STDCPP_OOM
  1591  #if  STDCPP_OOM
  1593 	User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1592 	User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1594 
  1593 
  1595 	 #endif
  1594 	 #endif
  1596  result1 = find_end( v1.begin( ), v1.end( ), v3.begin( ), v3.end( ) );
  1595  result1 = find_end( v1.begin( ), v1.end( ), v3.begin( ), v3.end( ) );
  1597  
  1596  
  1598  result2 = find_end ( v1.begin( ), v1.end( ), v4.begin( ), v4.end( ) );
  1597 // result2 = find_end ( v1.begin( ), v1.end( ), v4.begin( ), v4.end( ) );
  1599 #if  STDCPP_OOM 	
  1598 #if  STDCPP_OOM 	
  1600 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1599 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1601 
  1600 
  1602 #endif 
  1601 #endif 
  1603 
  1602 
  1727 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1726 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1728 
  1727 
  1729 #endif 
  1728 #endif 
  1730 test_variable1  = *max_element(test_array1,test_array1 + 8);
  1729 test_variable1  = *max_element(test_array1,test_array1 + 8);
  1731 test_variable2 = *max_element(test_array2,test_array2+5);
  1730 test_variable2 = *max_element(test_array2,test_array2+5);
  1732 int test_variable3 =*max_element(test_array1,test_array1 + 10);
  1731 int test_variable3 =*max_element(test_array1,test_array1 + 7);
  1733 
  1732 
  1734 #if  STDCPP_OOM 	
  1733 #if  STDCPP_OOM 	
  1735 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1734 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1736 
  1735 
  1737 
  1736 
  2148    try
  2147    try
  2149    { 
  2148    { 
  2150      int result_int1;
  2149      int result_int1;
  2151      int result_int2;
  2150      int result_int2;
  2152      char result_char;
  2151      char result_char;
  2153      float result_float;
  2152 //     float result_float;
  2154      #if  STDCPP_OOM
  2153      #if  STDCPP_OOM
  2155 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  2154 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  2156   
  2155   
  2157   #endif
  2156   #endif
  2158      result_int1 = max(2,1);
  2157      result_int1 = max(2,1);
  2525     }
  2524     }
  2526     
  2525     
  2527    // vector <int>::iterator vIter;
  2526    // vector <int>::iterator vIter;
  2528      
  2527      
  2529 
  2528 
  2530     vector <int>::reverse_iterator rvIter;
  2529 //    vector <int>::reverse_iterator rvIter;
  2531      
  2530      
  2532     vector <int>::iterator pos;
  2531     vector <int>::iterator pos;
  2533     
  2532     
  2534     pos = find ( vec.begin ( ), vec.end ( ), 4 );
  2533     pos = find ( vec.begin ( ), vec.end ( ), 4 );
  2535    
  2534    
  2585     {
  2584     {
  2586        L.push_back ( 2 * i );
  2585        L.push_back ( 2 * i );
  2587     }
  2586     }
  2588     
  2587     
  2589     
  2588     
  2590     list <int>::iterator L_Iter, LPOS = L.begin ( );
  2589     list <int>::iterator  LPOS = L.begin ( );
  2591 
  2590 
  2592    
  2591    
  2593   
  2592   
  2594 
  2593 
  2595     advance ( LPOS , 7 );
  2594     advance ( LPOS , 7 );