本文整理汇总了C++中Array::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::Find方法的具体用法?C++ Array::Find怎么用?C++ Array::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array::Find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteSolutionFolderListings
// WriteSolutionConfigs
//------------------------------------------------------------------------------
void SLNGenerator::WriteSolutionFolderListings( const Array< SLNSolutionFolder > & folders,
Array< AString > & solutionFolderPaths )
{
// Create every intermediate path
const SLNSolutionFolder * const foldersEnd = folders.End();
for( const SLNSolutionFolder * it = folders.Begin() ; it != foldersEnd ; ++it )
{
if ( solutionFolderPaths.Find( it->m_Path ) == nullptr )
{
solutionFolderPaths.Append( it->m_Path );
}
const char * pathEnd = it->m_Path.Find( NATIVE_SLASH );
while ( pathEnd )
{
AStackString<> solutionFolderPath( it->m_Path.Get(), pathEnd );
if ( solutionFolderPaths.Find( solutionFolderPath ) == nullptr )
{
solutionFolderPaths.Append( solutionFolderPath );
}
pathEnd = it->m_Path.Find( NATIVE_SLASH, pathEnd + 1 );
}
}
solutionFolderPaths.Sort();
// Solution Folders Listings
const AString * const solutionFolderPathsEnd = solutionFolderPaths.End();
for( const AString * it = solutionFolderPaths.Begin() ; it != solutionFolderPathsEnd ; ++it )
{
// parse solution folder name
const char * solutionFolderName = it->FindLast( NATIVE_SLASH );
solutionFolderName = solutionFolderName ? solutionFolderName + 1 : it->Get();
// generate a guid for the solution folder
AStackString<> solutionFolderGuid;
VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderGuid, *it );
// Guid must be uppercase (like visual)
solutionFolderGuid.ToUpper();
Write( "Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"%s\", \"%s\", \"%s\"\r\n",
solutionFolderName, solutionFolderName, solutionFolderGuid.Get() );
Write( "EndProject\r\n" );
}
}
示例2:
Array<String> Class_obj::GetInstanceFields()
{
Array<String> result = mSuper ? (*mSuper)->GetInstanceFields() : Array<String>(0,0);
if (mMembers.mPtr)
for(int m=0;m<mMembers->size();m++)
{
const String &mem = mMembers[m];
if (result->Find(mem)==-1)
result.Add(mem);
}
return result;
}
示例3: main
int main()
{
STUDENT student, student1, student2;
STUDENT* students = new STUDENT[3];
const char cFirstName[LEN_NAME] = "Vasya ";
const char cFirstName1[LEN_NAME] = "Petya ";
const char cFirstName2[LEN_NAME]= "Leshaa ";
strcpy (student.FirstName, cFirstName);
strcpy (student1.FirstName, cFirstName1);
strcpy (student2.FirstName, cFirstName2);
students[0] = student;
students[1] = student1;
students[2] = student2;
Array a (students, 3);
//delete[] students;
//size_t nQnt = a.GetQuantity();
//students = new STUDENT[nQnt];
//students = a.GetStudents();
for (size_t i = 0 ; i < 3; i++){
cout << students[i].FirstName<< endl;
}
for (size_t i = 0; i <5 ; i++){
cout << "ADD#"<< i <<".0"<<endl;
a.Add (students[0]);
cout << "ADD#"<< i <<".1"<<endl;
a.Add (students[0]);
cout << "ADD#"<< i <<".2"<<endl;
a.Add (students[0]);
}
delete[] students;
STUDENT** rStud = a.GetStudents();
size_t nQnt = a.GetQuantity();
cout << "Quantity is "<< nQnt<<endl;
for (size_t i = 0 ; i < nQnt; i++){
cout << i << ". "<< rStud[i]->FirstName<< endl;
}
STUDENT editStudent;
const char cFirstNameEdit[LEN_NAME]= "Edit ";
strcpy (editStudent.FirstName, cFirstNameEdit);
a.Edit (editStudent, 16);
cout<<"MAIN EDIT "<<endl;
a.Show ();
bool* arr = new bool[a.GetQuantity ()];
a.Find( "Vasya", COL_FIRST_NAME , arr );
cout<<"FIND "<<endl;
for (size_t i = 0; i < a.GetQuantity (); i++){
cout << i<<". "<< (bool)arr[i]<<endl;
}
delete[] arr;
a.DeleteStudent (14);
cout<<"DELETE "<<endl;
//a.Show ();
cout << "Hello World!" << endl;
return 0;
}