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

C++ Insert函数代码示例

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

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



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

示例1: Insert

// Insert the Value into its proper place in the binary search tree
void BST::Insert(int Value)
{  Insert(Root, Value);  }
开发者ID:clmitchell289,项目名称:CSUMB-CST238,代码行数:3,代码来源:BST.cpp


示例2: Insert

 void Insert(Type key)
 {
     Insert(root , key);
 }
开发者ID:fanshaoze,项目名称:acm-codes,代码行数:4,代码来源:NOTONLLY的SBT模板.cpp


示例3: Emplace

////////////////////////////////////////////////////////////////////////////////
// Construct and insert an account                                            //
//                                                                            //
// Parameters:                                                                //
// id:        the ID                                                          //
// plaintext: the plain password                                              //
//                                                                            //
// Return Value:                                                              //
// true if insert succeeded, false if the ID already exists                   //
////////////////////////////////////////////////////////////////////////////////
 bool AccountMap::Emplace( const ID& id, const Plaintext& plaintext ) {
  if(Insert(id, plaintext)) {
    return true;
  }
  return false;
}
开发者ID:emfomy,项目名称:dsa_final,代码行数:16,代码来源:account_map.cpp


示例4: Insert

void Tree::Insert(int data)
{
	Insert(Root, data);
}
开发者ID:andriy-kuz,项目名称:Algorithms,代码行数:4,代码来源:BinarySearchTree.cpp


示例5: PushBack

	void PushBack(const T& x)
	{
		Insert(End(), x);
	}
开发者ID:changfeng777,项目名称:DataStruct,代码行数:4,代码来源:List.hpp


示例6: Compute

void Compute(int i)
{
	int x1,x2,y1,y2;
	double edg1,edg2;
	x1=v[i].sx-tx;
	y1=v[i].sy-ty;
	x2=v[i].ex-tx;
	y2=v[i].ey-ty;
	if(y1==0&&y2==0)
		return;
	if(y1==0)
	{
		if(x1>0)
		{
			if(y2>0)
			{
				temp.sx=v[i].sx;
				temp.sy=v[i].sy;
				temp.ex=v[i].ex;
				temp.ey=v[i].ey;
				temp.edgs=0;
				temp.edge=atan2(y2,x2);
			}
			else
			{
				temp.sx=v[i].ex;
				temp.sy=v[i].ey;
				temp.ex=v[i].sx;
				temp.ey=v[i].sy;
				temp.edgs=atan2(y2,x2);
				temp.edge=0;
			}
		}
		else
		{
			if(y2>0)
			{
				temp.sx=v[i].ex;
				temp.sy=v[i].ey;
				temp.ex=v[i].sx;
				temp.ey=v[i].sy;
				temp.edgs=atan2(y2,x2);
				temp.edge=3.141592654;
			}
			else
			{
				temp.sx=v[i].sx;
				temp.sy=v[i].sy;
				temp.ex=v[i].ex;
				temp.ey=v[i].ey;
				temp.edgs=-3.141592654;
				temp.edge=atan2(y2,x2);
			}
		}
		Insert();
	}
	else if(y2==0)
	{
		if(x2>0)
		{
			if(y1>0)
			{
				temp.sx=v[i].ex;
				temp.sy=v[i].ey;
				temp.ex=v[i].sx;
				temp.ey=v[i].sy;
				temp.edgs=0;
				temp.edge=atan2(y1,x1);
			}
			else
			{
				temp.sx=v[i].sx;
				temp.sy=v[i].sy;
				temp.ex=v[i].ex;
				temp.ey=v[i].ey;
				temp.edgs=atan2(y1,x1);
				temp.edge=0;
			}
		}
		else
		{
			if(y1>0)
			{
				temp.sx=v[i].sx;
				temp.sy=v[i].sy;
				temp.ex=v[i].ex;
				temp.ey=v[i].ey;
				temp.edgs=atan2(y1,x1);
				temp.edge=3.141592654;
			}
			else
			{
				temp.sx=v[i].ex;
				temp.sy=v[i].ey;
				temp.ex=v[i].sx;
				temp.ey=v[i].sy;
				temp.edgs=-3.141592654;
				temp.edge=atan2(y1,x1);
			}
		}
//.........这里部分代码省略.........
开发者ID:sunheehnus,项目名称:USACO,代码行数:101,代码来源:Closed+Fences.c


示例7: Remove

void wxGISMenu::MoveCommandRight(size_t nIndex)
{
	wxMenuItem *pMenuItem = Remove(FindItemByPosition(nIndex));
	Insert(nIndex + 1, pMenuItem);
	wxGISCommandBar::MoveCommandRight(nIndex);
}
开发者ID:jacklibj,项目名称:r5,代码行数:6,代码来源:commandbar.cpp


示例8: TEXT

	Mesh* Mesh::CreateFromFBX(RenderSystem* pRenderSys, tstring const& filename)
	{ 
		try
		{
			tstring path = Core::GetInstance()->GetAssetsDir() + TEXT("/Models/") + filename;

			const aiScene* scene = aiImportFile(wstr2str(path).c_str(),
				aiProcessPreset_TargetRealtime_MaxQuality | aiProcess_ConvertToLeftHanded | aiProcess_TransformUVCoords);

			Float3 min, max;

			if (scene == nullptr || scene->mNumMeshes == 0)
				throw std::exception("No Mesh in this file");

			Mesh* ret = new Mesh();

			for (uint32 meshIndex = 0; meshIndex < scene->mNumMeshes; ++meshIndex)
			{
				MeshPart* part = ret->CreatePart();
				aiMesh* pAiPart = scene->mMeshes[meshIndex];

				int32 numVertices = pAiPart->mNumVertices;
				int32 numFaces = pAiPart->mNumFaces;
				int32 numUVChannels = scene->mMeshes[meshIndex]->GetNumUVChannels();

				if (!pAiPart->HasFaces()
					|| !pAiPart->HasNormals()
					|| !pAiPart->HasPositions()
					|| !pAiPart->HasTextureCoords(0)
					|| !pAiPart->HasTangentsAndBitangents())
				{
					ret->RemovePart(part);
					continue;
				};

				min = Float3((float*)&(pAiPart->mVertices[0]));
				max = Float3((float*)&(pAiPart->mVertices[0]));

				part->m_pInputLayout.reset(new InputLayout{
					{ VertexElemType::Float3, ElemSemantic::Position, 0, 0, ElementClass::PerVertex, 0 },
					{ VertexElemType::Float3, ElemSemantic::Normal, 0, 0, ElementClass::PerVertex, 0 },
					{ VertexElemType::Float3, ElemSemantic::Tangent, 0, 0, ElementClass::PerVertex, 0 },
				});
				auto layout = part->m_pInputLayout;
				for (int32 i = 0; i < numUVChannels; ++i)
					layout->Insert(layout->End(),
					{ VertexElemType::Float2, ElemSemantic::TexCoord, (uint32)i, 0, ElementClass::PerVertex, 0 });

				uint32 stride = layout->GetVertexStride(0);
				byte* vertices = new byte[stride * numVertices];
				uint16* indices = new uint16[3 * numFaces];
				
				auto elemPosition = layout->Begin();
				auto elemNormal = elemPosition + 1;
				auto elemTangent = elemNormal + 1;

#define Get(V,i,stride,offset) (V + stride * i + offset)
				for (int32 i = 0; i < numVertices; ++i)
				{
					*(Float3*)Get(vertices, i, stride, elemPosition->AlignedByteOffset) = Float3((float*)&(pAiPart->mVertices[i]));
					*(Float3*)Get(vertices, i, stride, elemTangent->AlignedByteOffset) = Float3((float*)&(pAiPart->mTangents[i]));
					*(Float3*)Get(vertices, i, stride, elemNormal->AlignedByteOffset) = Float3((float*)&(pAiPart->mNormals[i]));

					auto elemTexCoord = elemTangent + 1;
					for (int32 j = 0; j < numUVChannels; ++j)
					{
						aiVector3D texcoord = pAiPart->mTextureCoords[j][i];
						*(Float2*)Get(vertices, i, stride, elemTexCoord->AlignedByteOffset) = Float2((float*)&(pAiPart->mTextureCoords[j][i]));
						++elemTexCoord;
					}

#if	UV_MIRROR
					float t = dot(cross(scene->mMeshes[meshIndex]->mNormals[i], scene->mMeshes[meshIndex]->mTangents[i]), scene->mMeshes[meshIndex]->mBitangents[i]);
					if (t < 0)
						vertices[i].Tangent = float3(-vertices[i].Tangent.r, vertices[i].Tangent.g, vertices[i].Tangent.b);
#endif

					min.x = std::min(min.x, pAiPart->mVertices[i].x);
					min.y = std::min(min.y, pAiPart->mVertices[i].y);
					min.z = std::min(min.z, pAiPart->mVertices[i].z);
					max.x = std::max(max.x, pAiPart->mVertices[i].x);
					max.y = std::max(max.y, pAiPart->mVertices[i].y);
					max.z = std::max(max.z, pAiPart->mVertices[i].z);
				}
				part->m_Size = std::max(max.x - min.x, std::max(max.y - min.y, max.z - min.z));
				part->m_Center = Float3((min.x + max.x) / 2.0f, (min.y + max.y) / 2.0f, (min.z + max.z) / 2.0f);

				for (long long i = 0; i < numFaces; ++i)
				{
					aiFace* face = &(scene->mMeshes[meshIndex]->mFaces[i]);
					indices[3 * i] = face->mIndices[0];
					indices[3 * i + 1] = face->mIndices[1];
					indices[3 * i + 2] = face->mIndices[2];
					assert(
						indices[3 * i] <= numVertices && 
						indices[3 * i + 1] <= numVertices &&
						indices[3 * i + 2] <= numVertices 
					);
				}

//.........这里部分代码省略.........
开发者ID:clones1201,项目名称:Space,代码行数:101,代码来源:Mesh.cpp


示例9: main

int main()
{
	int n = -1;
	int flag = 0;
	int flag1;
	int save;
	struct Node * head;
	char fileName[20] = "0";

	flag = SignIn();           //登陆

	if(flag == 1)
	{
		head = InitLink();      //初始化
	}
	
	for(;;)  //各种功能 一直循环
	{
		fflush(stdin);				
		flag = 1;
		ReturnDesk();	

		system("clear");
		ShowDesk();
		fflush(stdin);
		scanf("%d", &n);
		fflush(stdin);	

		if(n == 0)
		{
			system("clear");
			FreeAllNodes(head);
			printf("\n\n\n\n\n\n               谢谢使用, ----made by Mr.Du 丶Lun\n\n\n\n\n\n");
			getch();
			exit(0);
		}//if

		if(n == 1)	
		{
			system("clear");
			Print(head);
		}//if
		if(n == 4)
		{
			system("clear");
			head = Sort(head);
			printf("sort over,new info:\n\n\n");
			Print(head);
		}
		if(n == 5)
		{
			system("clear");
			Print(head);
			Insert(head);
			system("clear");
			printf("insert over\n");
			Print(head);			
		}
		if(n == 6)
		{
			system("clear");
			Print(head);
			Remove(&head);
			system("clear");
			printf("remove over new info:\n");
			Print(head);
		}
		if(n == 8)
		{
			system("clear");
			Print(head);
			head =AddNodeBefore(head);
		}
		if(n == 9)
		{
			system("clear");
			Print(head);
			AddNodeAfter(head);
		}
		if(n == 10)
		{
			system("clear");
			printf("倒序排列为:\n");	
			head = Reverse(head);
			Print(head);
		}	
		if(n == 11)
		{
			system("clear");
			if(flag1 == -1)
			{
				Save_now_info(head, fileName);
				save = 1;
			}
			else
			{
				//printf("%d", flag);
				save = Save_info(head);
			}
			if(save == 1)
//.........这里部分代码省略.........
开发者ID:Dulun,项目名称:Summer2015,代码行数:101,代码来源:studentsys.c


示例10: Insert

 /// An equivalent to Insert(A), but more readable.
 void operator += (const ArrayT< Vector3T<T> >& A) { Insert(A); }
开发者ID:mark711,项目名称:Cafu,代码行数:2,代码来源:BoundingBox.hpp


示例11: lru_insert

 void lru_insert( Node *use_blk, Node *new_def ) { Insert(use_blk,new_def); }
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:1,代码来源:split_if.cpp


示例12: Insert

	//C-String Implementation of operator +=
	ZBasicString<A>& operator += (const char *_other) 
		{ Insert(Length(), _other); return *this; }
开发者ID:crertel,项目名称:onizuka-oculus-client,代码行数:3,代码来源:ZBasicString.hpp


示例13: Insert

//---------------------------------------------------------------------------
void __fastcall TCopyParamList::Add(const UnicodeString Name,
  TCopyParamType * CopyParam, TCopyParamRule * Rule)
{
  Insert(Count, Name, CopyParam, Rule);
}
开发者ID:seebigsea,项目名称:winscp,代码行数:6,代码来源:GUIConfiguration.cpp


示例14: main

int main(int argc, char * argv[]) {
    int numOfLists, sizeOfLists, i, j, bufferItem;
    double bubBest1, bubWorst1, bubAvg1, bubBest2, bubWorst2, bubAvg2, bubBest3, bubWorst3, bubAvg3, sum1, sum2, sum3;
    List Lists[1000];
    List bufferList;
    clock_t start1,end1, start2, end2, start3, end3;
    srand(time(NULL));
    if ((argc < 3) || (argc > 3)) { /*Checks preconditions for program*/
        printf("**Invalid number of arguments to run program**\n\n**Program will terminate now\n");
        return 1;
    }
    numOfLists = atoi(argv[1]);
    sizeOfLists = atoi(argv[2]); /*only lists of size 1000 and up to 1000 lists are supported*/
    if ((numOfLists>1000) || (numOfLists<=2) || (sizeOfLists>1000) || (sizeOfLists<=2)) {
        printf("**Invalid integer entered**\nOnly integers between 3 and 1000 are allowed\nProgram will terminate now\n");
        return 1;
    }
    Initialize(&bufferList);
    for (i=0; i<sizeOfLists; i++) {  /*Create two mandatory Lists*/
        Insert(i+1, i, &Lists[0]);
        Insert(sizeOfLists-i, i, &Lists[1]);
    }
    for (i=2; i<numOfLists; i++) {
        for (j=0; j<sizeOfLists; j++) {
            bufferItem = (rand() %343+1);  /*Create random lists*/
            Insert(bufferItem, bufferList.size, &bufferList);
        }
        Lists[i] = bufferList;
        Initialize(&bufferList);
    }
    sum1=0;
    bubAvg1 = 0;
    start1 = clock();         /*Starts Timer*/
    BubbleSort1(Lists[0]);
    end1 = clock();
    bubBest1 = (double)(end1-start1)/CLOCKS_PER_SEC;

    start2 = clock();
    BubbleSort1(Lists[1]);
    end2 = clock();
    bubWorst1 = (double)(end2-start2)/CLOCKS_PER_SEC;

    for (i=0; i<numOfLists; i++) {
        start3 = clock();
        BubbleSort1(Lists[i]);
        end3 = clock();
        sum1 = ((double)(end3-start3)/CLOCKS_PER_SEC);
        bubAvg1 = bubAvg1 + sum1;                  /*Finds the Average*/
    }
    bubAvg1 = bubAvg1/numOfLists;

    printf("\nBubbleSort1\n%f\n%f\n%f\n", bubBest1, bubAvg1, bubWorst1);

    sum2=0;
    bubAvg2 = 0;
    start1 = clock();
    BubbleSort2(Lists[0]);
    end1 = clock();
    bubBest2 = (double)(end1-start1)/CLOCKS_PER_SEC;

    start2 = clock();
    BubbleSort2(Lists[1]);
    end2 = clock();
    bubWorst2 = (double)(end2-start2)/CLOCKS_PER_SEC;

    for (i=0; i<numOfLists; i++) {
        start3 = clock();
        BubbleSort2(Lists[i]);
        end3 = clock();
        sum2 = ((double)(end3-start3)/CLOCKS_PER_SEC);
        bubAvg2 = bubAvg2 + sum2;
    }
    bubAvg2 = bubAvg2/numOfLists;


    printf("\nBubbleSort2\n%f\n%f\n%f\n", bubBest2, bubAvg2, bubWorst2);

    sum3=0;
    bubAvg3 = 0;
    start1 = clock();
    MergeSort(&Lists[0], 0, Lists[0].size-1);
    end1 = clock();
    bubBest3 = (double)(end1-start1)/CLOCKS_PER_SEC;

    start2 = clock();
    MergeSort(&Lists[1], 0, Lists[1].size-1);
    end2 = clock();
    bubWorst3 = (double)(end2-start2)/CLOCKS_PER_SEC;

    for (i=0; i<numOfLists; i++) {
        start3 = clock();
        MergeSort(&Lists[i], 0, Lists[i].size-1);
        end3 = clock();
        sum3 = ((double)(end3-start3)/CLOCKS_PER_SEC);
        bubAvg3 = bubAvg3 + sum3;
    }
    bubAvg3 = bubAvg3/numOfLists;

    printf("\nMergeSort\n%f\n%f\n%f\n", bubBest3, bubAvg3, bubWorst3);

//.........这里部分代码省略.........
开发者ID:cmarcott,项目名称:CIS2520,代码行数:101,代码来源:sort.c


示例15: Insert

void Insert()
{
	int j;
	for(j=tot;j>0;j--)
	{
		cur=tar[j];
		if(cur.edgs==temp.edgs)
		{
			if(Yes())
			{
				if(cur.edge==temp.edge)
				{
					tar[j]=temp;
					return;
				}
				else if(cur.edge<temp.edge)
				{
					temp.edgs=tar[j].edge;
					tar[j].sx=temp.sx;
					tar[j].sy=temp.sy;
					tar[j].ex=temp.ex;
					tar[j].ey=temp.ey;
					Insert();
					return;
				}
				else
				{
					tar[j].edgs=temp.edge;
					tot++;
					tar[tot]=temp;
					return;
				}
			}
			else
			{
				if(cur.edge==temp.edge)
				{
					return;
				}
				else if(cur.edge<temp.edge)
				{
					temp.edgs=tar[j].edge;
					Insert();
					return;
				}
				else
				{
					tar[j].edgs=temp.edge;
					tot++;
					tar[tot]=cur;
					tar[tot].edge=temp.edge;
					return;
				}
			}
		}
		else if(cur.edge==temp.edge)
		{
			if(Yes())
			{
				if(cur.edgs<temp.edgs)
				{
					tar[j].edge=temp.edgs;
					tot++;
					tar[tot]=temp;
					return;
					
				}
				else
				{
					temp.edge=tar[j].edgs;
					tar[j].sx=temp.sx;
					tar[j].sy=temp.sy;
					tar[j].ex=temp.ex;
					tar[j].ey=temp.ey;
					Insert();
					return;
				}
			}
			else
			{
				if(cur.edgs<temp.edgs)
				{
					tar[j].edge=temp.edgs;
					tot++;
					tar[tot]=tar[j];
					tar[tot].edgs=temp.edgs;
					tar[tot].edge=temp.edge;
					return;
					
				}
				else
				{
					temp.edge=tar[j].edgs;
					Insert();
					return;
				}
			}
		}
	}
	tot++;
//.........这里部分代码省略.........
开发者ID:sunheehnus,项目名称:USACO,代码行数:101,代码来源:Closed+Fences.c


示例16: s

csStringBase &csStringBase::Insert (size_t iPos, char iChar)
{
  csStringBase s(iChar);
  return Insert(iPos, s);
}
开发者ID:garinh,项目名称:cs,代码行数:5,代码来源:csstring.cpp


示例17: Insert

std::pair<DictIter, bool> LLBC_Variant::Insert(const Dict::key_type &key, const Dict::mapped_type &val)
{
    return Insert(Dict::value_type(key, val));
}
开发者ID:lailongwei,项目名称:llbc,代码行数:4,代码来源:Variant.cpp


示例18: Insert

//------------------------------------------------------------------------------
//
// 	Function Name:	CMLListCtrl::Add()
//
//	Parameters:		pMLElement - pointer to element to be added to the list control
//
// 	Return Value:	TRUE if successful
//
// 	Description:	This function is called to add a new element to the list box
//
//------------------------------------------------------------------------------
BOOL CMLListCtrl::Add(CMLListCtrlElement* pMLElement, BOOL bResizeColumns)
{
	return Insert(pMLElement, -1, bResizeColumns);
}
开发者ID:WilliamDrewAeroNomos,项目名称:muthur,代码行数:15,代码来源:MLListCtrl.cpp


示例19: switch

static char *DoDemangle( char *name, unsigned *add, unsigned *len, char *sig )
{
    char        *p;
    unsigned    first;

    switch( *sig++ ) {
    case SIGNATURE_ARRAY:
        Insert( name, add, len, " []" );
        while( isdigit( *sig ) ) ++sig;
        sig = DoDemangle( name, add, len, sig );
        break;
    case SIGNATURE_CLASS:
        p = strchr( sig, SIGNATURE_ENDCLASS );
        *p = '\0';
        Insert( name, add, len, sig );
        sig = p + 1;
        break;
    case SIGNATURE_FUNC:
        *add += Insert( name, add, len, "(" );
        first = 1;
        for( ;; ) {
            if( *sig == SIGNATURE_ENDFUNC ) break;
            if( !first ) {
                *add += Insert( name, add, len, "," );
            }
            sig = DoDemangle( name, add, len, sig );
            *add = *len;
            first = 0;
        }
        Insert( name, add, len, ")" );
        *add = 0;
        Insert( name, add, len, " " );
        sig = DoDemangle( name, add, len, sig+1 );
        *add = *len;
        break;
    case SIGNATURE_BYTE:
        *add += Insert( name, add, len, "byte" );
        break;
    case SIGNATURE_CHAR:
        *add += Insert( name, add, len, "char" );
        break;
    case SIGNATURE_FLOAT:
        *add += Insert( name, add, len, "float" );
        break;
    case SIGNATURE_DOUBLE:
        *add += Insert( name, add, len, "double" );
        break;
    case SIGNATURE_INT:
        *add += Insert( name, add, len, "int" );
        break;
    case SIGNATURE_LONG:
        *add += Insert( name, add, len, "long" );
        break;
    case SIGNATURE_SHORT:
        *add += Insert( name, add, len, "short" );
        break;
    case SIGNATURE_VOID:
        *add += Insert( name, add, len, "void" );
        break;
    case SIGNATURE_BOOLEAN:
        *add += Insert( name, add, len, "boolean" );
        break;
    }
    return( sig );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:65,代码来源:jvmsym.c


示例20: Insert

wxTaskBarJumpListItem*
wxTaskBarJumpListCategory::Prepend(wxTaskBarJumpListItem *item)
{
    return Insert(0, item);
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:5,代码来源:taskbarbutton.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ InsertColumn函数代码示例发布时间:2022-05-30
下一篇:
C++ InputPortConfig_Void函数代码示例发布时间: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