当前位置: 首页>>代码示例>>C++>>正文


C++ Array::Contains方法代码示例

本文整理汇总了C++中Array::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::Contains方法的具体用法?C++ Array::Contains怎么用?C++ Array::Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Array的用法示例。


在下文中一共展示了Array::Contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

TEST(MapTests, GetValues)
{
	Map<int, int> Value1;
	Value1.Set(1, 4);
	Value1.Set(2, 5);
	Value1.Set(3, 6);

	Array<int> Values = Value1.GetValues();

	EXPECT_TRUE(Values.Length() == 3);
	EXPECT_TRUE(Values.Contains(4));
	EXPECT_TRUE(Values.Contains(5));
	EXPECT_TRUE(Values.Contains(6));
}
开发者ID:TLeonardUK,项目名称:Ludo,代码行数:14,代码来源:Map.Tests.cpp

示例2: Test

bool Array::Test (ostream & os) {
  bool success = true;

  Array arr;

  TEST(arr.elements != NULL);
  TEST(arr.length == 0);
  TEST(arr.capacity == DEFAULT_CAPACITY);

  const ArraySize CAP = 5;
  Array arr2(CAP);

  TEST(arr2.elements != NULL);
  TEST(arr2.length == 0);
  TEST(arr2.capacity == CAP);

  const ArraySize TEST = 200;
  for (ArraySize i = 0; i < TEST; i++) {arr2.Push("I know my abc's");}
 
  TEST(arr2.length == TEST);
  TEST(arr2.capacity == (CAP*MULT_FACTOR*MULT_FACTOR));

  arr.Push("a");
  arr.Push("be");
  arr.Push("cat");
  arr.Push("dog");
  arr.Push("elephant");
  arr.Push("ferret");
  arr.Push("goat");
  arr.Push("house");
  arr.Push("igloo");

  TEST(arr.length == 9);
  TEST(arr.capacity == DEFAULT_CAPACITY);
  TEST(arr.Contains("a"));
  TEST(arr.Contains("be"));
  TEST(arr.Contains("cat"));
  TEST(arr.Contains("dog"));
  TEST(arr.Contains("elephant"));
  TEST(arr.Contains("ferret"));
  TEST(arr.Contains("goat"));
  TEST(arr.Contains("house"));
  TEST(arr.Contains("igloo"));
  TEST(!arr.Contains(""));
  TEST(!arr.Contains("Eric"));
  TEST(!arr.Contains("%$%[email protected]#jasfj;qwoeij;;akdjIIJIJOIJ||ej1214938u54083u**(*3"));

  Array arr3(arr);
  TEST(&arr3.elements != &arr.elements);
  TEST(arr3.length == arr.length);
  TEST(arr3.capacity == arr.capacity);
  TEST(arr3.Contains("dog"));

  arr3 = arr2;
  TEST(&arr3.elements != &arr2.elements);
  TEST(arr3.length == arr2.length);
  TEST(arr3.capacity == arr2.capacity);
  TEST(arr3.Contains("I know my abc's"));

  return success;
}
开发者ID:ericpeterson,项目名称:Web-Crawler,代码行数:61,代码来源:Array.cpp

示例3: AddIfNotExists

 inline bool AddIfNotExists(Array<int>& list, int x)
 {
   if (list.Contains(x)) return false;
   list.Append(x);
   return true;
 }
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:6,代码来源:stlgeom.hpp

示例4: IsInArray

 inline int IsInArray(int n, const Array<int>& ia)
 {
   return ia.Contains(n);
 }
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:4,代码来源:stlgeom.hpp

示例5: GenerateBoundaryLayer


//.........这里部分代码省略.........
         // surface elements being added during the process
         int np = mesh.GetNP();
         int nse = mesh.GetNSE();

         // Safety measure to ensure no issues with mesh 
         // consistency
         int nseg = mesh.GetNSeg();

         // Indicate which points need to be remapped
         BitArray bndnodes(np);

         // Map of the old points to the new points
         Array<int> mapto(np);

         // Growth vectors for the prismatic layer based on 
         // the effective surface normal at a given point
         Array<Vec3d> growthvectors(np);

         // Bit array to identify all the points belonging 
         // to the surface of interest
         bndnodes.Clear();

         // Run through all the surface elements and mark the points 
         // belonging to those where a boundary layer has to be created.
         // In addition, also calculate the effective surface normal 
         // vectors at each of those points to determine the mesh motion 
         // direction
         cout << "Marking points for remapping...." << endl;

         for (i = 1; i <= nse; i++)
         {
            int snr = mesh.SurfaceElement(i).GetIndex();
            // cout << "snr = " << snr << endl;
            if (surfid.Contains(snr))
            {
               Element2d & sel = mesh.SurfaceElement(i);
               int selNP = sel.GetNP();
               for(j = 1; j <= selNP; j++)
               {
                  // Set the bitarray to indicate that the 
                  // point is part of the required set
                  bndnodes.Set(sel.PNum(j));
		  
                  // Vec3d& surfacenormal = Vec3d();   ????
                  Vec3d surfacenormal;

                  // Calculate the surface normal at the current point 
                  // with respect to the current surface element
                  GetSurfaceNormal(mesh,sel,j,surfacenormal);
                  
                  // Add the surface normal to the already existent one 
                  // (This gives the effective normal direction at corners 
                  //  and curved areas)
                  growthvectors.Elem(sel.PNum(j)) = growthvectors.Elem(sel.PNum(j)) 
                                                    + surfacenormal;
               }
            }
         }

         // Add additional points into the mesh structure in order to 
         // clone the surface elements.
         // Also invert the growth vectors so that they point inwards, 
         // and normalize them
         cout << "Cloning points and calculating growth vectors...." << endl;

         for (i = 1; i <= np; i++)
开发者ID:Resistancerus,项目名称:Netgen,代码行数:67,代码来源:boundarylayer.cpp


注:本文中的Array::Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。