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


C++ TwoDArray::remove方法代码示例

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


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

示例1:

Test(arrayTest, remove) {
  TwoDArray<int>* i = new TwoDArray<int>(5, 5, 0);
  TwoDArray<double>* d = new TwoDArray<int>(5, 5, 0);
  TwoDArray<std::string>* s = new TwoDArray<std::string>(5, 5, "o");
  
  i->insert(2, 2, 7);
  d->insert(4, 4, 3.145);
  s->insert(0, 0, "Hello");
  i->insert(3, 3, 9);
  
  i->remove(2, 2);
  d->remove(4, 4);
  s->remove(0, 0);

  s->insert(0, 0, "y");

  EXPECT_EQ(0, i->access(2, 2));
  EXPECT_EQ(0, d->access(4, 4));
  EXPECT_EQ("y", s->access(0, 0));
  EXPECT_EQ(9, i->insert(3, 3));

  delete i;
  delete d;
  delete s;
}
开发者ID:hcsnyder,项目名称:csci333-Project2,代码行数:25,代码来源:Array_test.cpp

示例2:

TEST(TwoDArrayTest, remove) {
  TwoDArray<int>* td = new TwoDArray<int>(10, 10, 42);
  td->insert(5, 5, 12);
  
  td->remove(5, 5);
  EXPECT_EQ(42, td->access(5,5));
  delete td;
}
开发者ID:nb-unca-projects,项目名称:TwoDArray,代码行数:8,代码来源:ArrayTest.cpp

示例3:

TEST(remove, integerTest) {
    int r = 10;
    int c = 10;
    TwoDArray<int>* a = new TwoDArray<int>(r, c);
    a->insert(0, 0, 400);
    a->remove(0, 0);
    ASSERT_TRUE(a->access(0, 0) != 400);
    delete a;
}
开发者ID:aviindub,项目名称:TwoDArray,代码行数:9,代码来源:TwoDArray.cpp

示例4:

TEST(TwoDArray, Remove) {
	TwoDArray<int>* newInt = new TwoDArray<int>(5,5,0);
	newInt->insert(2,3,4);
	newInt->remove(2,3);
	EXPECT_EQ(0, newInt->access(2,3));
	delete newInt;

	TwoDArray<double>* newDouble = new TwoDArray<double>(3,4,1.0);
	newDouble->insert(2,1,4.4);
	newDouble->remove(2,1);
	EXPECT_EQ(1.0, newDouble->access(2,3));
	delete newDouble;

	TwoDArray<std::string>* newString = new TwoDArray<std::string>(100,200,"empty");
	newString->insert(48, 68, "hello");
	newString->remove(2,3);
	EXPECT_EQ("hello", newString->access(48,68));
	delete newString;
}
开发者ID:billymills,项目名称:sparse-array-api,代码行数:19,代码来源:Sparse.cpp

示例5:

TEST(TwoDArrayRemove, RemoveDouble) {
    TwoDArray<double>* tDDouble = new TwoDArray<double>(10, 10, 0.0);
    
    for (int i=0; i<10; i++) {
	  tDDouble->insert(i, i, 7);
    }
    tDDouble->remove(7, 5);
    EXPECT_EQ(0.0, tDDouble->access(7, 5));
    delete tDDouble;
}
开发者ID:GregGay,项目名称:csci333_Project2,代码行数:10,代码来源:TwoDArray.cpp

示例6: main

int main(){

	TwoDArray<int>* newArray = new TwoDArray<int>(10, 10, 0);

	newArray->insert(1,1,5);
	cout << newArray->access(1,1) << endl;
	newArray->remove(1,1);
	cout << newArray->access(1,1) << endl;
	newArray->print();
	delete newArray;

	TwoDArray<std::string>* nextArray = new TwoDArray<std::string>(5,5, "hi");
	nextArray->insert(2,2, "bye");
	nextArray->print();
	delete nextArray;

}
开发者ID:billymills,项目名称:sparse-array-api,代码行数:17,代码来源:array_test.cpp


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