Sequential containers: vector deque List
Adapters: According to the operations provided by the original container type, adapt the base container type by defining a new operating interface.
Container element initialization:
C
Conly applies to sequential containers, must give default constructor
Conly applicable to sequ
value of the dialog box. Namespaces: System.Windows.FormsAssembly: System.Windows.Forms (in System.Windows.Forms.dll)DialogResult: is an enumeration class that can be instantiated to receive user actions in a dialog boxDialogResult dr = Printdialog1.showdialog ();if (dr = = DialogResult.OK)//If the user clicks on the OK button, then perform print {Printdocument1.print ();}The return value of the OK dialog box is ok (usually sent from a button labeled OK).
dialog box controls:ColorDialo
, either size () or empty () to check if the container is empty.Priority Queue PrioritiesThe elements within the priority queue are sorted according to their priorities, with header files
Push () puts an element into the priority queue
Top () returns the first element in the priority queue, but does not remove
Pop () removes an element, but does not return
If there are no elements in the priority queue, top () and pop () cause a
C + + Primer (Fifth edition) learning Note _6_ Standard Template Library _set collection containerThe Set collection container implements the data structure of the balanced binary search tree of the red and Black Tree (Red-blacktree), and when the element is inserted, it automatically adjusts the sorting of the binary tree and places the element in the appropriate position.(1) Ensure that the key value of e
C + + Primer (Fifth edition) learning Note _8_ Standard Template Library _map mapping containerThe element data of a map mapping container consists of a key value and a mapping data, which has a relationship of one by one mappings between the key value and the mapping data.The data structure of the map mapping container is also implemented using red and black tre
C + + security concurrency Access container elements2014-9-24 FlyfishStandard library STL vectors, deque, list, etc. are not thread-safeFor exampleThread 1 is using an iterator (iterator) to read the vectorThread 2 is inserting the vector, causing the vector to reallocate memory so that the iterator in thread 1 is invalidatedContainer for STLMultiple thread reads are secure and cannot have any write operati
The C + + list function is detailedFirst of all, how to debug under the Eclipse tool: You have to set a breakpoint, and then start your application in debug mode, do not run, when the program runs to your breakpoint location will stop, you will be prompted to enter the Debug view mode of operation, F5 is entered into the inside of a function or statement block, F6 is a single step, a line of walking, F7 can jump the current listener function or statem
When using a std::list
The list in the STL is a two-way linked list, which can be inserted efficiently to delete elements.
The list does not support random access. So there is no at (POS) and operator[].
The list object List1, List2 has element List1 (1,2,3), List2 (4,5,6) respectively. list
Construction, deconstruction
List
### Other ###
C.size ()///Returns the number of elements in the container
c.swap (C2)///convert C2 an
C ++ Primer study note _ 55_STL analysis (10): Container adapter (stack, queue, priority_queue) source code analysis and use example
Seven basic containers: vector, deque, list, set, multiset, map, and multimap
I. Container AdapterStackQueuePriority_queue
Stack, queue, and priority_queue do not support any type of iterator. They are all
Content"EndlVector Int> VEC1 (num,num+10);cout"The element VEC before swapping:";72Print (VEC);cout"Pre-swap element VEC1:";74Print (VEC1);75Vec1.swap (VEC);cout"Post-swap element VEC:";77Print (VEC);cout"Post-swap element VEC1:";79Print (VEC1);8081//Can be compared between containers, as compared to a string82if (vec>VEC1)83{cout"Vec>vec1"Endl85}86Else87{cout"Vec"Endl89}9091//Sortcout"Sort the VEC1"EndlIter_int=Vec1.begin ();94 Sort (iter_int,iter_int+Vec1.size ());95Print (VEC1);9697//Begin (
vector element number valuesuch as: string str[7] = {"Has fun", "has fun", "Good Luck", "Good Luck", "has Fun", "has Fun", "has Fun"};VectorA.pop_back ();CoutCoutCoutProgram output:7) Other functionsvoid swap (vector); Exchange data for two vectors of the same typevoid assign (int n,const t x); Sets the value of the nth element in a vector to Xvoid Assign (Const_iterator first,const_iterator last); Sets the element in the vector [First,last] to the current vector element8) Common algorithms So
controlled sequenceIterator Erase (iterator first,iterator last); Delete all elements within the range [First,last] in the controlled sequenceSize_type Erase (const key Key); Deletes an element with an element value equal to key and returns the number of deleted elementsvoid Clear (); Emptying the controlled sequence7) Other operation functions void swap (set x); Swap set elementsvoid swap (multiset x); Exchanging multiset elements Key_compare Key_comp () const; Returns a function for compari
appear, and calls the Print_result function to output the function*/106 intMainintargcChar**argv)107 {108 ifstream infile;109 if(!open_file (infile,"Infile.txt")) the ThrowRuntime_error ("no Remove file");111 textquery TQ; the Tq.read_file (infile);113 while(true) the { thecout"Enter word to look for, or Q to quit:"; the strings;117Cin>>s;118 if(!cin| | s=="Q") Break;119 SetTq.run_query (s); - Print_result (LOCS,S,TQ);121 122 }123 return 0;12
tail of the elements out of the team).The sample code that defines the Priority_queue object is as follows:Priority_queuePriority_queuePriority_queuePriority_queue basic operations are the same as the queue/*(Repair Ranch) Enter a set of data to get the minimum right and*/#include#include#include//Queue Templatesusing namespacestd;//priority_queuepriority_queueint, vectorint, greaterint> > Q;//priority Queue definition Small first-out teamintMain () {intN, M; cout"input array length n:"; CIN>>N
C + + Primer learning Note _14_ Standard Template Library _bitset bit collection containerThe Bitset container is a bit-bit element of the sequence container, each element occupies only one bit bit, the value is 0 or 1, thus saving memory space. is a Bitset store that uses only two bytes of space for its 10 elements.Use Bitset to declare header file "#include 1.
Generic concept.Sequential containers are basically understood: the elements are stored sequentially, and the ability to provide element-specific operations (iterators or other) and sequential access to elements is provided.Personal Understanding:1) Order: Sort by added order of precedence. However, advanced priority or backward priority depends on the specific container. Personal application:1) Use the containe
C # control series-container controls,C # control series-container control mainly includes: FlowLayoutPanel, GroupBox, Panel, SplitConTainer, TabControl, and TableLayoutPanel. Panel FunctionIn C language-> what?
-> Is a whole. It is used to point to a struct, class in
C ++ Primer learning note _ 45 _ template (III): Default template parameters (Stack template is implemented using the standard template container deque), member template, and keyword typename1. Default template parameters
1. Can stack memory be managed using standard template containers? The answer is yes. You only need to pass one more template parameter, and the template parameter can also be the default
The Access member function returns a reference, Front,back,at, and the following table, if a container is const, a const reference is returned, or a normal reference if the container is not const.Whether the return is a reference, the key is to see if the expression in the left or right value, if the right value, return is a copy of the element, if the left value, return is a reference object.When using aut
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.