• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Foo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Foo函数的典型用法代码示例。如果您正苦于以下问题:C++ Foo函数的具体用法?C++ Foo怎么用?C++ Foo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: TEST

TEST(Result, inspect)
{
    struct Foo
    {
        int val;

        Foo(int v) : val(v) {}
        Foo(Foo&&) = default;
        Foo(const Foo&) = delete;
        Foo& operator = (Foo&&) = default;
        Foo& operator = (const Foo&) = delete;

        bool operator == (const Foo& other) const
        {
            return this->val == other.val;
        }
    };

    Result<Foo> foo = Ok(Foo(1));
    EXPECT_TRUE(foo.is_ok());
    EXPECT_FALSE(foo.is_err());
    EXPECT_EQ(foo.get_success(), Some(Foo(1)));
    EXPECT_EQ(foo.get_failure(), ""_s);
    foo = Err("oops"_s);
    EXPECT_FALSE(foo.is_ok());
    EXPECT_TRUE(foo.is_err());
    EXPECT_EQ(foo.get_success(), None<Foo>());
    EXPECT_EQ(foo.get_failure(), "oops"_s);
}
开发者ID:GermanTMW2015,项目名称:tmwa,代码行数:29,代码来源:result_test.cpp


示例2: TEST

TEST( Hit_Check_Test, CircleHit ){
	
	wing::DefaltLoader Loader;
	auto img = Loader.load();

	{
		TestSprite Hoge(60,60,img,wing::Position(-10,20));
		TestSprite Foo(80,80,img,wing::Position(80,-10));
		ASSERT_EQ(wing::sprite::checkRectHit(Hoge, Hoge) , false);

		ASSERT_EQ(wing::sprite::checkCircleHit(Hoge, Foo) , false);
	}

	{
		TestSprite Hoge(60,60,img,wing::Position(-0,0));
		TestSprite Foo(80,80,img,wing::Position(20,0));

		ASSERT_EQ(wing::sprite::checkCircleHit(Hoge, Foo) , true);
	}

	{
		TestSprite Hoge(60,60,img,wing::Position(0,0));
		TestSprite Foo(80,80,img,wing::Position(70,0));

		ASSERT_EQ(wing::sprite::checkCircleHit(Hoge, Foo) , false);
	}

}
开发者ID:ikaro1192,项目名称:WingLibrary,代码行数:28,代码来源:sprite_test.cpp


示例3: AssertFoo

testing::AssertionResult AssertFoo(const char* m_expr, const char* n_expr, const char* k_expr, int m, int n, int k) {
    if (Foo(m, n) == k)
        return testing::AssertionSuccess();
    testing::Message msg;
    msg << m_expr << " 和 " << n_expr << " 的最大公约数应该是:" << Foo(m, n) << " 而不是:" << k_expr;
    return testing::AssertionFailure(msg);
}
开发者ID:sdgdsffdsfff,项目名称:kingso,代码行数:7,代码来源:gtest_sample.cpp


示例4: decode

int64_t decode(void *buffer, size_t size, int64_t sum)
{
    unsigned int i;
    C(table_t) foobarcontainer;
    FooBar(vec_t) list;
    FooBar(table_t) foobar;
    Bar(struct_t) bar;
    Foo(struct_t) foo;

    foobarcontainer = C(as_root(buffer));
    sum += C(initialized(foobarcontainer));
    sum += StringLen(C(location(foobarcontainer)));
    sum += C(fruit(foobarcontainer));
    list = C(list(foobarcontainer));
    for (i = 0; i < FooBar(vec_len(list)); ++i) {
        foobar = FooBar(vec_at(list, i));
        sum += StringLen(FooBar(name(foobar)));
        sum += FooBar(postfix(foobar));
        sum += (int64_t)FooBar(rating(foobar));
        bar = FooBar(sibling(foobar));
        sum += (int64_t)Bar(ratio(bar));
        sum += Bar(size(bar));
        sum += Bar(time(bar));
        foo = Bar(parent(bar));
        sum += Foo(count(foo));
        sum += Foo(id(foo));
        sum += Foo(length(foo));
        sum += Foo(prefix(foo));
    }
    return sum + 2 * sum;
}
开发者ID:heibao,项目名称:flatcc,代码行数:31,代码来源:benchflatcc.c


示例5: Test2

void Test2() {
  // CHECK-DTOR-LABEL: Test2
  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR1:[0-9]+]])
  // CHECK-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR1:[^ ]+]])
  // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR2:[0-9]+]])
  // CHECK-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR2:[^ ]+]])
  // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
  // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[VAR2]])
  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR2]])
  // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[VAR1]])
  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR1]])
  // CHECK-DTOR: }

  // CHECK-NO-DTOR-LABEL: Test2
  // CHECK-NO-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR1:[0-9]+]])
  // CHECK-NO-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR1:[^ ]+]])
  // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
  // CHECK-NO-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR2:[0-9]+]])
  // CHECK-NO-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR2:[^ ]+]])
  // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
  // CHECK-NO-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR2]])
  // CHECK-NO-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR1]])
  // CHECK-NO-DTOR: }
  const A &a = A{};
  Foo(a);
  const A &b = A{};
  Foo(b);
}
开发者ID:AntonBikineev,项目名称:clang,代码行数:29,代码来源:temporary-lifetime.cpp


示例6: Test1

void Test1() {
  // CHECK-DTOR-LABEL: Test1
  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
  // CHECK-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR:[^ ]+]])
  // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
  // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[VAR]])
  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
  // CHECK-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR:[^ ]+]])
  // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
  // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[VAR]])
  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
  // CHECK-DTOR: }

  // CHECK-NO-DTOR-LABEL: Test1
  // CHECK-NO-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
  // CHECK-NO-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR:[^ ]+]])
  // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
  // CHECK-NO-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
  // CHECK-NO-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
  // CHECK-NO-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR:[^ ]+]])
  // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
  // CHECK-NO-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
  // CHECK-NO-DTOR: }
  {
    const A &a = A{};
    Foo(a);
  }
  {
    const A &a = A{};
    Foo(a);
  }
}
开发者ID:AntonBikineev,项目名称:clang,代码行数:33,代码来源:temporary-lifetime.cpp


示例7: TEST

TEST(FooTest, HandleNoneZeroInput)

{

	EXPECT_EQ(2, Foo(4, 10));

	EXPECT_EQ(6, Foo(30, 18));

}
开发者ID:moving-on,项目名称:Mycode,代码行数:9,代码来源:gtest1.cpp


示例8: UserTypeInContainer

		void UserTypeInContainer(YAML::Emitter& out, std::string& desiredOutput)
		{
			std::vector<Foo> fv;
			fv.push_back(Foo(5, "hello"));
			fv.push_back(Foo(3, "goodbye"));
			out << fv;
			
			desiredOutput = "- x: 5\n  bar: hello\n- x: 3\n  bar: goodbye";
		}
开发者ID:Airstriker,项目名称:viewer,代码行数:9,代码来源:emittertests.cpp


示例9: main

int main()
{
    Foo( 12, 345, 678, 90 );
    Foo( 11, 22, 33, 44 );
    Foo( 99, 88, 77, 66 );

    return 0;
    
}
开发者ID:andrewjinyounglee,项目名称:PerVERT,代码行数:9,代码来源:protofoo.c


示例10: foo

void foo()
{
  std::cout << "========== Foo ==============\n";

  Foo foo = Foo() + Foo();

  std::cout << "=============================\n";

}
开发者ID:gary109,项目名称:cppblog,代码行数:9,代码来源:case3.cpp


示例11: UserType

		void UserType(YAML::Emitter& out, std::string& desiredOutput)
		{
			out << YAML::BeginSeq;
			out << Foo(5, "hello");
			out << Foo(3, "goodbye");
			out << YAML::EndSeq;
			
			desiredOutput = "- x: 5\n  bar: hello\n- x: 3\n  bar: goodbye";
		}
开发者ID:Airstriker,项目名称:viewer,代码行数:9,代码来源:emittertests.cpp


示例12: Bar

void Bar(T... t)
{
    Foo(t...); // invokes Foo once with all arguments in the pack
    
    std::cout << "------------------\n";
    
    using swallow = int[];
    void(swallow{0, (void(Foo(t)), 0)...}); // invokes Foo once for each argument in the pack
}
开发者ID:CCJY,项目名称:coliru,代码行数:9,代码来源:main.cpp


示例13: main

int main()
{
   Foo({}, {});   // Foo(int = 0, int = 0)
   Foo({1}, {2}); // Foo(int = 1, int = 2)
   Foo({1, 2});   // Foo(int = 1, int = 2)

   bar({}, {});   // bar(int = 0, int = 0)
   bar({1}, {2}); // bar(int = 1, int = 2)
   bar({1, 2});   // error: no matching function for call to 'bar'  <<< Why? <<<
}
开发者ID:CCJY,项目名称:coliru,代码行数:10,代码来源:main.cpp


示例14: main

int main(int argc, char** argv)
{
    unsigned long int num;

    puts("Enter the number:");
    scanf("%lu",&num);

    printf("%lu",Foo(num));     // Виклик функції
    PrintBinary(num);		// Друк (2 код) аргумента
    PrintBinary(Foo(num));	// Друк (2 код) результату
    return 0;
}
开发者ID:Urbanskiy,项目名称:omgitsdone,代码行数:12,代码来源:lab6.cpp


示例15: main

int main(int argc, char** argv)
{
    unsigned long int num;

    puts("Enter the number:");
    scanf("%lu",&num);

    printf("%lu",Foo(num));     // Виклик ф-ції Foo
    PrintBinary(num);
    PrintBinary(Foo(num));
	return 0;
}
开发者ID:Urbanskiy,项目名称:omgitsdone,代码行数:12,代码来源:lab9.cpp


示例16: main

int main(int argc, char** argv)
{
    unsigned long int num;

    puts("Enter the number:");
    scanf("%ld",&num);

    printf("%ld",Foo(num));     // Виклик ф-ції Foo
    PrintBinary(num);		// Друк (2 код) аргумента
    PrintBinary(Foo(num));	// Друк (2 код) результату
	return 0;
}
开发者ID:Urbanskiy,项目名称:omgitsdone,代码行数:12,代码来源:lab5.cpp


示例17: Test6

void Test6() {
  // CHECK-DTOR-LABEL: Test6
  // CHECK-DTOR: call void @llvm.lifetime.start(i64 {{[0-9]+}}, i8* nonnull %[[ADDR:[0-9]+]])
  // CHECK-DTOR: call i32 @_Z3BazIiET_v()
  // CHECK-DTOR: store
  // CHECK-DTOR: call void @_Z3FooIiEvOT_
  // CHECK-DTOR: call void @llvm.lifetime.end(i64 {{[0-9]+}}, i8* nonnull %[[ADDR]])
  // CHECK-DTOR: call void @llvm.lifetime.start(i64 {{[0-9]+}}, i8* nonnull %[[ADDR:[0-9]+]])
  // CHECK-DTOR: call i32 @_Z3BazIiET_v()
  // CHECK-DTOR: store
  // CHECK-DTOR: call void @_Z3FooIiEvOT_
  // CHECK-DTOR: call void @llvm.lifetime.end(i64 {{[0-9]+}}, i8* nonnull %[[ADDR]])
  // CHECK-DTOR: }
  Foo(Baz<int>());
  Foo(Baz<int>());
}
开发者ID:AntonBikineev,项目名称:clang,代码行数:16,代码来源:temporary-lifetime.cpp


示例18: main

int main()
{

    std::vector<Foo> vFoo;

    for(int i = 0; i < 100; ++i)
        vFoo.push_back(Foo());

    for(auto it = vFoo.begin(); it != vFoo.end(); ++it)
        std::cout << *it << " ";   
    std::cout << std::endl;

    std::sort(vFoo.begin(), vFoo.end(), greater);

    for(auto it = vFoo.begin(); it != vFoo.end(); ++it)
        std::cout << *it << " ";   
    std::cout << std::endl;

    std::sort(vFoo.begin(), vFoo.end());

    for(auto it = vFoo.begin(); it != vFoo.end(); ++it)
        std::cout << *it << " ";   
    std::cout << std::endl;

    std::sort(vFoo.begin(), vFoo.end(), FooComparator());

    for(auto it = vFoo.begin(); it != vFoo.end(); ++it)
        std::cout << *it << " ";   
    std::cout << std::endl;
    std::cout << std::endl;


    return 0;
}
开发者ID:OlexandrSavchuk,项目名称:cpp-lessons,代码行数:34,代码来源:sorting.cpp


示例19: main

int main(int argc, char **argv) {
	Foo f = Foo();
	A a = A();
	f.bar(5);
	a.c();
	return 0;
}
开发者ID:Vinayakatk,项目名称:linuxtools,代码行数:7,代码来源:cpptest.cpp


示例20: BuildNeigh

//  TODO: Can use dynamic scheduling here
int BuildNeigh( void* arg, int id ) {
  double rd, cutoffSquare;
  int    i,j;

  cutoffSquare  = (cutoffRadius * TOLERANCE)*(cutoffRadius * TOLERANCE);

  for (i = (numMoles / NTHREADS) * id; i < (numMoles / NTHREADS) * (id + 1); ++i) {
    for (j = i+1; j<numMoles; j++ ) {
    	rd = Foo ( (double)x[IND(0,i)], (double)x[IND(1,i)], (double)x[IND(2,i)],
    	           (double)x[IND(0,j)], (double)x[IND(1,j)], (double)x[IND(2,j)]);

      if (rd > cutoffSquare) {
        continue;
      }

      BEGIN_TRANSACTION();

      //printf("APP: writing i: %x (%x), with value: %d\n", &inter[INDX(ninter,0)], &(inter[INDX(ninter,0)]._value), i);
      inter[INDX(ninter,0)] = i;
      //printf("APP: writing j: %x (%x), with value: %d\n", &inter[INDX(ninter,1)], &(inter[INDX(ninter,1)]._value), j);
      inter[INDX(ninter,1)] = j;
      ++ninter;

      COMMIT_TRANSACTION();

      if ( ninter >= MAXINTERACT) {
        perror("MAXINTERACT limit");
      }
    }
  }

  return 0;
}
开发者ID:sysudengle,项目名称:TM_project,代码行数:34,代码来源:moldyn.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Fopen函数代码示例发布时间:2022-05-30
下一篇:
C++ FontPlatformData函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap