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


C++ Foo函数代码示例

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


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


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