You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+74-13Lines changed: 74 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,13 @@ The containers are implemented as generic class templates, means that a containe
9
9
10
10
Following are some common containers :
11
11
12
-
# vector : replicates arrays
13
-
# queue : replicates queues
14
-
# stack : replicates stack
15
-
# priority_queue : replicates heaps
16
-
# list : replicates linked list
17
-
# set : replicates trees
18
-
# map : associative arrays
12
+
###vector : replicates arrays
13
+
###queue : replicates queues
14
+
###stack : replicates stack
15
+
###priority_queue : replicates heaps
16
+
###list : replicates linked list
17
+
###set : replicates trees
18
+
###map : associative arrays
19
19
20
20
# Classification of Containers in STL
21
21
Containers are classified into four categories :
@@ -105,7 +105,8 @@ int main ()
105
105
Site Link : https://www.studytonight.com/cpp/stl/stl-pair-template
106
106
107
107
# C++ My Codes :
108
-
# Calculator
108
+
109
+
## Calculator
109
110
```
110
111
#include <iostream>
111
112
using namespace std;
@@ -155,7 +156,7 @@ int main()
155
156
return 0;
156
157
}
157
158
```
158
-
# Container
159
+
##Container
159
160
```
160
161
/*
161
162
Container library is collection of classes
@@ -171,7 +172,7 @@ int main()
171
172
return 0;
172
173
}
173
174
```
174
-
# Function Templates
175
+
##Function Templates
175
176
176
177
Templates are powerful features of C++ which allows you to write generic programs. In simple terms, you can create a single function or a class to work with different data types using templates.
177
178
Templates are often used in larger codebase for the purpose of code reusability and flexibility of the programs.
@@ -226,7 +227,7 @@ int main()
226
227
}
227
228
```
228
229
229
-
# Pair Template
230
+
##Pair Template
230
231
231
232
```
232
233
/*Templates are powerful features of C++ which allows you to write generic programs. In simple terms, you can create a single function or a class to work with different data types using templates.
@@ -280,7 +281,7 @@ int main()
280
281
return 0;
281
282
}
282
283
```
283
-
# Swap Templates
284
+
##Swap Templates
284
285
285
286
```
286
287
#include<iostream>
@@ -319,7 +320,7 @@ int main()
319
320
}
320
321
```
321
322
322
-
# Vector Size
323
+
##Vector Size
323
324
324
325
```
325
326
#include<iostream>
@@ -347,3 +348,63 @@ int main()
347
348
return 0;
348
349
}
349
350
```
351
+
##
352
+
```
353
+
/*
354
+
Array is collection of similar element
355
+
STL has predefine class array
356
+
like this
357
+
array<int,4> obj;
358
+
Here a array is formed with side 4
359
+
to use this you need to include array
360
+
template<place holder>
361
+
class array{
362
+
};
363
+
*/
364
+
#include<iostream>
365
+
#include<array>
366
+
using namespace std;
367
+
int main()
368
+
{
369
+
array<int,4> data1={2,5,6,7};
370
+
// use this extra array with swap
371
+
array<int,4> data2={1,4,5,9};
372
+
// we can also initilize it here
373
+
// like this
374
+
// array<int,4> data={2,5,6,8};}
375
+
// it show some error
376
+
// to fix it click on setting
377
+
// if you are using dev then check on tool comiler option read the error and copy it on genneral add by tick
378
+
cout<<data1.at(1)<<endl; // it show index array start from 0
0 commit comments