1
00:00:00,060 --> 00:00:07,840
Last section of the studio, so we can go to our last section and we will be studying glass templates

2
00:00:07,860 --> 00:00:10,290
in C++, that's our topic for now.

3
00:00:10,320 --> 00:00:11,950
So what is it template?

4
00:00:11,970 --> 00:00:14,690
That's kind of a difficult question.

5
00:00:14,700 --> 00:00:22,250
Most of the C++ to speed Glanzer these days here in my lecture, I want to keep it more simple, not

6
00:00:22,290 --> 00:00:23,140
sophisticated.

7
00:00:23,160 --> 00:00:25,920
So let's see what is the use of a template.

8
00:00:25,930 --> 00:00:33,030
So in C++, suppose if I want to use a function, write to add two numbers, what will be the possible

9
00:00:33,030 --> 00:00:33,810
thing I can do?

10
00:00:33,810 --> 00:00:39,810
I can create the integer function, write, I can create a function integers like it's an integer function

11
00:00:40,110 --> 00:00:48,600
int some write and I can divide the function and I can add two numbers eight plus B and I can add two

12
00:00:48,600 --> 00:00:49,320
numbers, right?

13
00:00:49,380 --> 00:00:54,240
Suppose if I want to add two floating point numbers, then the same function.

14
00:00:54,240 --> 00:00:56,610
I need to define floor function.

15
00:00:56,610 --> 00:01:01,800
They float some and I need to parse the value of sending the code addition to the values.

16
00:01:02,280 --> 00:01:06,210
So then we introduce a concept card templates.

17
00:01:06,300 --> 00:01:12,080
Our life becomes more easier in the sense, like we will be creating a genetic data, right?

18
00:01:12,090 --> 00:01:13,500
So it's all about genetics.

19
00:01:13,660 --> 00:01:21,330
Sometimes we can't or this stuff s genetics because we are creating a genetic variable Part D so that

20
00:01:21,330 --> 00:01:24,780
genetic variable or genetic type Scarlett and Blade.

21
00:01:25,200 --> 00:01:31,890
And instead of creating different functions for different data, think you may be using a template function

22
00:01:32,280 --> 00:01:38,380
which will actually assign the day by day, according to the name that is really missing?

23
00:01:38,400 --> 00:01:45,930
Suppose if I am calling that template based on chain maxima or something, and I want to add two numbers

24
00:01:46,620 --> 00:01:48,690
man, that'd be no better than numbers.

25
00:01:48,810 --> 00:01:50,940
That'd be floating point at that number.

26
00:01:51,120 --> 00:01:54,600
Then I'd be like integer that I have.

27
00:01:54,600 --> 00:01:56,910
No, I can't have a single function.

28
00:01:57,300 --> 00:02:05,580
And if I'm passing the variables along with the database which they are, my life becomes more easier.

29
00:02:05,580 --> 00:02:09,990
It becomes for me to use a single function to ask those things right.

30
00:02:10,140 --> 00:02:12,960
So here again, see the syntax template.

31
00:02:13,380 --> 00:02:18,510
This is not exactly what by name, but you can use what I wrote a generic name.

32
00:02:18,750 --> 00:02:24,360
You want a name type named Capital X. I name capital by type and name gap.

33
00:02:24,730 --> 00:02:26,760
Is that anything is right here?

34
00:02:26,760 --> 00:02:29,040
Me, we are naming it capital D..

35
00:02:29,280 --> 00:02:31,920
OK, then I'm creating a function.

36
00:02:32,220 --> 00:02:33,630
D. My Emacs.

37
00:02:33,810 --> 00:02:42,430
This will actually compute maximum of two data nodes medium boost and return the maximum value.

38
00:02:42,450 --> 00:02:51,300
So I'm getting tired variable called Xanthi variable for white and this is all genetic data by variable.

39
00:02:51,510 --> 00:02:56,410
I have not used a specific database like integer or Florida debris.

40
00:02:56,850 --> 00:03:01,950
If X is greater than 10x, if BI is greater than my two symbol function.

41
00:03:02,130 --> 00:03:05,910
Now, inside the main function, I have my max function.

42
00:03:05,910 --> 00:03:13,080
I am calling my Emacs function and deciding to compare two numbers of integer type, so I am passing.

43
00:03:13,710 --> 00:03:16,620
This is that syntax using angle bracket.

44
00:03:16,620 --> 00:03:23,460
You have the boss that they Typekit, then you have to open the normal brackets and fosu that values.

45
00:03:23,880 --> 00:03:25,920
So here what going happen?

46
00:03:26,130 --> 00:03:32,640
The campaign internally generates this function where it will make this function going into this function,

47
00:03:32,640 --> 00:03:37,890
or because it's it should be an integer function so it automatically create in my Emacs.

48
00:03:37,890 --> 00:03:45,180
Then it replaces on the daemon, int then in my Macs, then indexing right, then return greater than

49
00:03:45,180 --> 00:03:48,240
white check that will return that value.

50
00:03:48,450 --> 00:03:54,960
Now, when you are using that same function to convert to catechist, this will internally generate

51
00:03:55,230 --> 00:03:59,860
this card becomes like this and it will generate gamma.

52
00:03:59,870 --> 00:04:04,410
Emacs, Gattex and Dowdall then return greater than White X on the right.

53
00:04:04,410 --> 00:04:08,080
Then it will then that higher value.

54
00:04:08,370 --> 00:04:09,610
OK, that's it.

55
00:04:09,690 --> 00:04:11,220
Very similar template.

56
00:04:11,310 --> 00:04:18,630
You only need to i the that it should be first you out to create a genetic template name or type name.

57
00:04:18,990 --> 00:04:20,830
For that you will to use this index.

58
00:04:21,060 --> 00:04:23,850
You can just by heard this index.

59
00:04:24,090 --> 00:04:30,170
Then you again create the function in order to like instead of using that right there that maybe you

60
00:04:30,170 --> 00:04:36,690
can use the bank name over here should be that OK, then this is that a dynamic results would be.

61
00:04:36,870 --> 00:04:37,860
This is the argument.

62
00:04:37,860 --> 00:04:40,780
That's also the one I started.

63
00:04:41,460 --> 00:04:47,520
You can see on here, you can pause the data type and values, then the function will be changed automatically

64
00:04:47,520 --> 00:04:50,700
by the campaign and it will do you that action.

65
00:04:50,910 --> 00:04:54,780
So the are the outlook window function template right now.

66
00:04:55,410 --> 00:04:58,080
OK, let's go to our function template here.

67
00:04:58,080 --> 00:04:59,010
It's very simple.

68
00:04:59,010 --> 00:04:59,880
I have already.

69
00:05:00,000 --> 00:05:08,140
Plot attack, the extreme namespace then created the template type name B B, my Max D X and divided

70
00:05:08,150 --> 00:05:14,790
by next data, and then I'm comparing three different it's my Emacs passing integer.

71
00:05:14,820 --> 00:05:19,510
Then it will create an integer function and three and seven parsing Dobare.

72
00:05:19,530 --> 00:05:23,190
Then it will create that double function instead of using.

73
00:05:23,220 --> 00:05:27,700
These will be replacing with debris everywhere and then characters.

74
00:05:27,750 --> 00:05:29,610
Now let's run this program.

75
00:05:29,850 --> 00:05:35,250
It's very straightforward, so I'm not taking that much time with this lecture.

76
00:05:35,580 --> 00:05:42,600
So how we can bring back G Plus Plus template doc CBB.

77
00:05:44,460 --> 00:05:50,070
OK, I'm not in desktop, see the desktop now again.

78
00:05:51,130 --> 00:05:53,500
C++ template, OK, KB.

79
00:05:54,170 --> 00:06:01,150
Right now, we can run this by it, how we can on this bad Dodge Dart.

80
00:06:03,540 --> 00:06:04,320
Yes.

81
00:06:05,310 --> 00:06:11,190
Comparing the first statement is comparing doing business with owning seven second statements comparing

82
00:06:11,550 --> 00:06:18,390
to integers, but not to bring this back to double dynamic returning the right answer.

83
00:06:18,480 --> 00:06:19,020
Seven.

84
00:06:19,350 --> 00:06:21,540
And that's one which is a great one.

85
00:06:22,320 --> 00:06:25,530
And it's always so it's comparing to Atticus.

86
00:06:25,680 --> 00:06:29,300
I was saying if I was doing this, comparing two characters and pretending that the.
