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


C++ FixedArray::size方法代码示例

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


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

示例1: A

NODE_IMPLEMENTATION(transpose_mXX, Pointer)
{
    FixedArray*  Aarray = NODE_ARG_OBJECT(0, FixedArray);
    const Class* mtype  = static_cast<const Class*>(Aarray->type());
    FixedArray*  Carray = static_cast<FixedArray*>(ClassInstance::allocate(mtype));

    EigenMatXf A(Aarray->data<float>(), Aarray->size(0), Aarray->size(1));
    EigenMatXf C(Carray->data<float>(), Aarray->size(0), Aarray->size(1));

    C = A.transpose();
    NODE_RETURN(Carray);
}
开发者ID:jimhourihan,项目名称:mu,代码行数:12,代码来源:MathLinearModule.cpp

示例2: int

TEST(Containers, ArrayBool)
{
	FixedArray<20, bool> array;
	FixedArray<20, bool> &cref = array;

	EXPECT_TRUE(array.empty());
	EXPECT_TRUE(cref.empty());
	EXPECT_EQ(array.size(), 0);
	EXPECT_EQ(cref.size(), 0);

	EXPECT_TRUE(array.push_back(true));
	EXPECT_FALSE(array.empty());
	EXPECT_FALSE(cref.empty());
	EXPECT_EQ(array.front(), true);
	EXPECT_EQ(cref.front(), true);
	EXPECT_TRUE(array.pop_back());
	EXPECT_FALSE(array.pop_back());
	EXPECT_TRUE(array.empty());
	EXPECT_TRUE(cref.empty());

	EXPECT_TRUE(array.push_back(false));
	EXPECT_TRUE(array.push_back(true));
	EXPECT_EQ(array.front(), false);
	EXPECT_EQ(cref.front(), false);
	EXPECT_EQ(array.back(), true);
	EXPECT_EQ(cref.back(), true);
	EXPECT_EQ(array.size(), 2);
	EXPECT_EQ(cref.size(), 2);

	array.clear();
	EXPECT_EQ(array.size(), 0);
	EXPECT_TRUE(array.empty());

	for(unsigned i=0; i< array.capacity(); i++)
		EXPECT_TRUE(array.push_back(i & 1));
	EXPECT_FALSE(array.push_back(-1));

	for(unsigned i=0; i < array.capacity(); i++)
	{
		EXPECT_EQ(array[i], int(i & 1));
		EXPECT_EQ(cref[i], int(i & 1));
	}

	for(unsigned i=0; i < array.capacity(); i++)
	{
		EXPECT_EQ(array.back(), int(array.capacity() - 1 - i) & 1);
		EXPECT_EQ(cref.back(), int(cref.capacity() - 1 - i) & 1);
		EXPECT_TRUE(array.pop_back());
	}
}
开发者ID:Dema,项目名称:Mcucpp,代码行数:50,代码来源:containers.cpp

示例3:

Rect BoundingBox::project2D(const Matrix4x4& projection) const
{
    Vector3 projMin = min;
    Vector3 projMax = max;
    
    //     2+------+3
    //     /|     /|
    //    / |    / |
    //   / 0+---/--+1
    // 6+------+7 /
    //  | /    | /
    //  |/     |/
    // 4+------+5

    FixedArray<Vector4, 8> corners;
    corners[0] = Vector4(projMin, 1.0);
    corners[1] = Vector4(projMax.x, projMin.y, projMin.z, 1.0);
    corners[2] = Vector4(projMin.x, projMax.y, projMin.z, 1.0);
    corners[3] = Vector4(projMax.x, projMax.y, projMin.z, 1.0);
    corners[4] = Vector4(projMin.x, projMin.y, projMax.z, 1.0);
    corners[5] = Vector4(projMax.x, projMin.y, projMax.z, 1.0);
    corners[6] = Vector4(projMin.x, projMax.y, projMax.z, 1.0);
    corners[7] = Vector4(projMax, 1.0);
   
    Rect rect;
    for(unsigned int i = 0; i < corners.size(); ++i)
    {
        Vector4 projected = projection * corners[i];
        rect.mergePoint(Vector2(projected.x / projected.w, projected.y / projected.w));
    }

    return rect;
}
开发者ID:A-K,项目名称:Huurre3D,代码行数:33,代码来源:BoundingBox.cpp


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