本文整理汇总了C++中DynArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ DynArray::size方法的具体用法?C++ DynArray::size怎么用?C++ DynArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynArray
的用法示例。
在下文中一共展示了DynArray::size方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateRenderMesh
void CClipVolumeProxy::UpdateRenderMesh(IRenderMesh* pRenderMesh, const DynArray<Vec3>& meshFaces)
{
m_pRenderMesh = pRenderMesh;
gEnv->pEntitySystem->ReleaseBSPTree3D(m_pBspTree);
const size_t nFaceCount = meshFaces.size() / 3;
if(nFaceCount > 0)
{
IBSPTree3D::FaceList faceList;
faceList.reserve(nFaceCount);
for(int i=0; i<meshFaces.size(); i+=3)
{
IBSPTree3D::CFace face;
face.push_back(meshFaces[i + 0]);
face.push_back(meshFaces[i + 1]);
face.push_back(meshFaces[i + 2]);
faceList.push_back(face);
}
m_pBspTree = gEnv->pEntitySystem->CreateBSPTree3D(faceList);
}
if(m_pEntity && m_pClipVolume)
gEnv->p3DEngine->UpdateClipVolume(m_pClipVolume, m_pRenderMesh, m_pBspTree, m_pEntity->GetWorldTM(), !m_pEntity->IsHidden(), m_pEntity->GetName());
}
示例2: InitLevelTypesEnums
void CEditorGame::InitLevelTypesEnums(IGameToEditorInterface* pGTE)
{
DynArray<string>* levelTypes;
levelTypes = g_pGame->GetIGameFramework()->GetILevelSystem()->GetLevelTypeList();
const char** allLevelTypes = new const char*[levelTypes->size()];
for (int i = 0; i < levelTypes->size(); i++)
{
PREFAST_ASSUME(i > 0 && i < levelTypes->size());
allLevelTypes[i] = (*levelTypes)[i];
}
pGTE->SetUIEnums("level_types", allLevelTypes, levelTypes->size());
delete[] allLevelTypes;
}
示例3: parse
// ---------------------------------------------------------------- //
bool CommandInterpreter::parse( CommandProcessor& cp, const char* command )
{
if (!command)
return false;
if(command[0] == '#') //Comment
return true;
// Split the command into full command name and parameter list
DynArray<string> split;
{ FOREACH_TOKEN( token, command, "()" ) split.add( token ); }
if( split.size() < 1 || split.size() > 2 ) return false;
const char* strFullCommandName = "EMPTY";
const char* strParams = "EMPTY";
if(split.size() >= 1) {
strFullCommandName = split[0].c_str();
if(split.size() == 2)
strParams = split[1].c_str();
}
// Request the command
CommandRef commandRef = cp.requestCommand( strFullCommandName );
if( commandRef && commandRef->object )
{
CommandParameters* cmdParams;
parseParams( cp, commandRef, strParams, cmdParams );
// Call the command
commandRef->action->call( commandRef->object, *cmdParams );
delete cmdParams;
return true;
}
parseErrors.add("Command not found.");
return false;
}
示例4: save_perm
// guarda permutación perm de tamaño sz, del conjunto charset, en array
void save_perm(DynArray<string> & array, const string & perm,
char * charset, const size_t & sz)
{
const size_t array_size = array.size();
if (array_size > 0)
{
int i = binary_search(array, perm); // verifica si la
// permutación no ha sido
// generada previamente
if (array.access(i) == perm)
return; // la permutación ya fue generada (hay símbolos repetidos)
}
if (is_a_permutation(perm, charset, sz))
array[array_size] = perm;
}
示例5: parseParams
// ---------------------------------------------------------------- //
bool CommandInterpreter::parseParams( CommandProcessor& cp
, CommandCached const * const cmd
, const char* strParams
, CommandParameters*& out )
{
// Now split the parameter list
DynArray<const char*> params;
{ FOREACH_TOKEN( token, strParams, "," ) params.add( token ); }
// Make sure the parameter list is the expected size
if( params.size() < cmd->input.size() )
{
parseErrors.add("Not enough parameters.");
return false;
}
// Loop through the signature and pack all of the parameters into the command parameters class
out = new CommandParameters( cmd->getSignatureSize( cp, params ) );
int offset = 0;
for( int i=0; i<cmd->input.size(); ++i )
parseAndPack( cp, cmd->input[i], params[i], *out, offset );
return true;
}
示例6: take_time
double take_time(DynArray<T> & a, Now & timer)
{
timer.start();
insertion_sort(a,0,a.size());
return timer.elapsed();
}
示例7: assertTrue
* ---------------------------------------------------------------------
*/
#include <KarenCore/array.h>
#include <KarenCore/parsing.h>
#include <KarenCore/test.h>
using namespace karen;
KAREN_BEGIN_UNIT_TEST(ArrayTestSuite);
KAREN_DECL_TEST(shouldCreateEmptyArray,
{
DynArray<int> a;
assertTrue(a.isEmpty());
assertEquals<int>(0, a.size());
});
KAREN_DECL_TEST(shouldNotIndexWhenEmpty,
{
DynArray<int> a;
try
{
a[0];
assertionFailed("expected exception not raised");
}
catch (OutOfBoundsException&) {}
});
KAREN_DECL_TEST(shouldCreateFromRawArray,
{
示例8:
#include "sfz/PopWarnings.hpp"
#include "sfz/containers/DynArray.hpp"
#include "sfz/math/Vector.hpp"
#include "sfz/memory/DebugAllocator.hpp"
#include "sfz/memory/New.hpp"
#include "sfz/memory/SmartPointers.hpp"
using namespace sfz;
TEST_CASE("Default constructor", "[sfz::DynArray]")
{
sfz::setContext(sfz::getStandardContext());
DynArray<float> floatArray;
REQUIRE(floatArray.size() == 0);
REQUIRE(floatArray.capacity() == 0);
REQUIRE(floatArray.data() == nullptr);
}
TEST_CASE("Fill constructor", "[sfz::DynArray]")
{
sfz::setContext(sfz::getStandardContext());
DynArray<UniquePtr<int>> nullptrs;
nullptrs.addMany(8);
for (uint32_t i = 0; i < 8; ++i) {
REQUIRE(nullptrs.data()[i] == nullptr);
}
REQUIRE(nullptrs.size() == 8);
REQUIRE(nullptrs.capacity() == 8);