1
00:00:01,100 --> 00:00:09,830
OK, so now that we have our basic linked list in this short video, we are going to add a little bit

2
00:00:09,830 --> 00:00:11,330
more functionality.

3
00:00:11,960 --> 00:00:23,660
So this video is just going to be about templating our link list actually, so we can have it hold different

4
00:00:23,930 --> 00:00:24,830
data types.

5
00:00:25,580 --> 00:00:28,880
So let's go ahead and get started.

6
00:00:29,740 --> 00:00:34,730
I'm going to head over to the header file for our node class.

7
00:00:36,590 --> 00:00:48,950
And if you remember from templating part of the course, we are going to start out a same template and

8
00:00:48,950 --> 00:00:52,630
then I might just call this class T pretty standard.

9
00:00:55,880 --> 00:01:06,280
And we are going to have to change this L.A. So it's going to be in L.A. T.

10
00:01:07,250 --> 00:01:15,060
And we will also want to change our node in here to an L.A. T.

11
00:01:15,500 --> 00:01:22,190
This is no longer going to be an integer for a data because it can be different types.

12
00:01:22,250 --> 00:01:24,230
So it's going to be type T.

13
00:01:26,330 --> 00:01:27,080
Same down.

14
00:01:27,080 --> 00:01:37,040
Here are actual member data member here is going to be can type T and this whole node as well.

15
00:01:37,160 --> 00:01:41,370
It's going to need to be declared for as a template as well.

16
00:01:42,470 --> 00:01:46,250
And then so what we're going to do right now.

17
00:01:47,590 --> 00:01:59,800
Is and might remember this from the previous templating videos, but we're going to include the CP file,

18
00:01:59,800 --> 00:02:00,460
actually.

19
00:02:04,240 --> 00:02:13,600
So because of this, we're going to have to actually go in and at our configurations and I'm sorry,

20
00:02:13,600 --> 00:02:21,520
go ahead and edit our R C make build file so we can accommodate for this and add in our templates and

21
00:02:21,520 --> 00:02:21,790
stuff.

22
00:02:21,790 --> 00:02:26,070
We're going to want to remove some stuff from our project so everything compiles.

23
00:02:26,100 --> 00:02:26,530
OK?

24
00:02:28,300 --> 00:02:28,630
All right.

25
00:02:28,630 --> 00:02:33,940
So let's head over to our CP file.

26
00:02:34,970 --> 00:02:35,540
And.

27
00:02:36,830 --> 00:02:46,580
It is working, so this file we are going to see.

28
00:02:48,020 --> 00:02:56,000
We're actually going to comment about this because we do not want a circular include.

29
00:02:57,470 --> 00:03:01,640
So because we included RCMP file in the head of their.

30
00:03:04,420 --> 00:03:11,710
And we are going to I mean, just copy paste this template so we can put it above each of our functions.

31
00:03:14,050 --> 00:03:20,440
So I want to put that here, and this is going to become the tea.

32
00:03:22,450 --> 00:03:23,170
Let's see.

33
00:03:25,980 --> 00:03:27,450
Let's do this here.

34
00:03:29,910 --> 00:03:31,290
I'm actually.

35
00:03:33,480 --> 00:03:37,020
And comment this just for now, but

36
00:03:42,360 --> 00:03:46,740
it turns out no t, we need to change our scope resolution.

37
00:03:47,680 --> 00:03:49,650
You just go ahead and paste this here.

38
00:03:51,320 --> 00:04:00,050
All right, so let's change this to so we're just having to go through and change everything into templated

39
00:04:01,220 --> 00:04:05,510
version, so that returns Typekit instead of it now.

40
00:04:09,160 --> 00:04:09,730
OK.

41
00:04:10,480 --> 00:04:15,310
Let's see if we got that to change that.

42
00:04:17,610 --> 00:04:18,510
And.

43
00:04:20,690 --> 00:04:22,850
I think that should be.

44
00:04:24,990 --> 00:04:25,650
Good.

45
00:04:27,730 --> 00:04:29,050
Let's go back here.

46
00:04:34,010 --> 00:04:35,630
Make sure that we have everything.

47
00:04:42,310 --> 00:04:47,200
And the I'm going to go ahead and comment this out now.

48
00:04:55,940 --> 00:05:00,380
So let's go over to our list here.

49
00:05:05,360 --> 00:05:06,080
And.

50
00:05:08,230 --> 00:05:09,460
For this.

51
00:05:11,550 --> 00:05:14,100
You don't need to put the.

52
00:05:15,290 --> 00:05:16,850
Data type you.

53
00:05:22,630 --> 00:05:25,330
Let's see, we have this.

54
00:05:28,730 --> 00:05:36,620
Change that to do the same thing as well and include our CP file here.

55
00:05:38,140 --> 00:05:44,540
So the last US BP and this is one of several ways to do this.

56
00:05:46,400 --> 00:05:53,710
You can also put the include the header and the CP in the client file.

57
00:05:54,410 --> 00:05:56,570
I command CBP instead of doing this.

58
00:05:58,990 --> 00:06:04,480
But for this, like, we're going to have to remove some things from our project.

59
00:06:04,510 --> 00:06:09,370
They'll stay in the same directory, but we're just going to have to change or see my file or make a

60
00:06:09,370 --> 00:06:12,120
new project from sources and just check those boxes.

61
00:06:12,370 --> 00:06:15,640
And they include certain things in our in our project.

62
00:06:15,640 --> 00:06:18,760
So clients able to compile it OK.

63
00:06:20,910 --> 00:06:25,470
All right, yeah, so I'm just making sure that I want the right stuff here.

64
00:06:26,010 --> 00:06:27,180
I think that.

65
00:06:30,500 --> 00:06:38,960
Tom, this out, and let's just copy paste these guys first.

66
00:06:44,590 --> 00:06:45,850
OK, so.

67
00:06:47,880 --> 00:06:50,370
This we know it's going to have to have.

68
00:06:52,560 --> 00:06:55,410
Type T on it and.

69
00:07:00,120 --> 00:07:00,960
Same here.

70
00:07:03,650 --> 00:07:05,000
This is now passing.

71
00:07:06,760 --> 00:07:07,570
Type T.

72
00:07:10,950 --> 00:07:11,640
This.

73
00:07:17,160 --> 00:07:18,600
We need to.

74
00:07:20,490 --> 00:07:22,410
Change, this is where I actually.

75
00:07:25,170 --> 00:07:26,100
That break point.

76
00:07:29,720 --> 00:07:30,740
And.

77
00:07:34,640 --> 00:07:35,780
Let's see.

78
00:07:39,780 --> 00:07:43,290
I think that should be pretty much.

79
00:07:45,670 --> 00:07:46,780
Everything.

80
00:07:50,660 --> 00:07:58,220
This is red, but hoping things will change once we update our see make file.

81
00:08:00,990 --> 00:08:05,800
OK, so let's head over to our main cup.

82
00:08:05,910 --> 00:08:11,580
Hopefully, these have everything, if not, then I'll be encountering an error that we'll have to fix.

83
00:08:12,960 --> 00:08:19,170
So you might have already seen me miss something and are already on top of it, but let's go ahead and

84
00:08:19,170 --> 00:08:24,240
go back over to Main and add this in here.

85
00:08:29,740 --> 00:08:34,120
So I'm actually going to make a.

86
00:08:37,000 --> 00:08:38,490
Another type.

87
00:08:38,530 --> 00:08:46,390
Oh, yeah, my bad not to acquire those red when I call this on and this is going to be type integer

88
00:08:47,230 --> 00:08:56,860
for one last year, and then I'm going to make another list and it's going to be a cha.

89
00:08:59,050 --> 00:09:04,210
So I'm just going to call this link list to really great of a name.

90
00:09:05,050 --> 00:09:07,270
You know what, actually, let's just call it in English.

91
00:09:11,140 --> 00:09:11,980
And

92
00:09:18,610 --> 00:09:20,140
so now I have two lists.

93
00:09:20,800 --> 00:09:29,140
One is a cha one, two S. And I'm going to change this, the charge taking our data.

94
00:09:32,080 --> 00:09:34,690
And then I'm going to put a little condition down here.

95
00:09:36,750 --> 00:09:43,380
Where if we encounter a sea, it is digit.

96
00:09:43,410 --> 00:09:47,700
Yeah, we encounter something that is a digit.

97
00:09:48,300 --> 00:09:49,560
We will.

98
00:09:55,060 --> 00:09:55,800
Copy this.

99
00:09:57,870 --> 00:10:10,470
We will append the data in a minute minus subtract the cha zero just for ASCII purposes because we're

100
00:10:10,470 --> 00:10:14,130
going to want to change that cha into an end.

101
00:10:15,400 --> 00:10:20,680
And so I'm going to want what the same number that's appearing is the charm, but I'm going to want

102
00:10:20,730 --> 00:10:21,760
to actual integers.

103
00:10:21,760 --> 00:10:26,680
So this is a nice kind of basic way to do that.

104
00:10:27,160 --> 00:10:28,240
And

105
00:10:30,880 --> 00:10:37,810
otherwise, I'm just going to append it to the linked list char.

106
00:10:39,100 --> 00:10:45,850
And it's going to be in it normally because I'm taking in a char is the data now and we will print that

107
00:10:45,850 --> 00:10:51,100
first list and then we will print the second list.

108
00:10:54,690 --> 00:11:03,600
And so because I did that, I'm going to go into our input file and I'm just going to do a b c d e f

109
00:11:03,600 --> 00:11:04,110
g.

110
00:11:04,290 --> 00:11:07,320
So one two three four five six seven a b c d e f g.

111
00:11:09,530 --> 00:11:10,190
And.

112
00:11:12,550 --> 00:11:15,640
Me see if I need anything else here.

113
00:11:17,970 --> 00:11:19,610
I think we should begin to go.

114
00:11:20,300 --> 00:11:28,640
And so what I'm going to have to do is we're we're going to need to go into this see make lists file.

115
00:11:30,530 --> 00:11:38,090
And we are actually we just need to actually take out.

116
00:11:39,430 --> 00:11:40,240
These

117
00:11:42,940 --> 00:11:48,010
CBP files, so we could take them all out, actually.

118
00:11:48,280 --> 00:11:50,410
It's kind of pointless to have the headers.

119
00:11:53,010 --> 00:11:54,120
In there, but.

120
00:11:57,670 --> 00:11:59,200
Yeah, I'll just take those out.

121
00:11:59,740 --> 00:12:01,300
I'm going to reload the changes.

122
00:12:02,870 --> 00:12:11,420
And go ahead and run this and see if it works, and so if everything is correct, we should get what

123
00:12:11,780 --> 00:12:16,280
we see down here, as well as a lengthy list of chores.

124
00:12:20,280 --> 00:12:27,780
OK, so we have a problem already here, did not could

125
00:12:31,740 --> 00:12:32,970
not put that there.

126
00:12:35,330 --> 00:12:37,130
OK, let's try that again.

127
00:12:40,120 --> 00:12:40,800
OK.

128
00:12:41,740 --> 00:12:42,400
Nice.

129
00:12:44,150 --> 00:12:44,810
So.

130
00:12:47,210 --> 00:12:48,380
It's like we have both of those.

131
00:12:50,080 --> 00:12:53,530
All right, so this is just us prepping actually for.

132
00:12:55,370 --> 00:13:05,840
A few coding assignments where we're actually going to start turning this into a doubling length list

133
00:13:06,560 --> 00:13:17,510
and then we're going to have to look at inserting into these lists and a few problems algorithms to

134
00:13:17,540 --> 00:13:21,140
go through this list and do some different things.

135
00:13:21,950 --> 00:13:28,100
But today it was just about or this video was just about template in our link list so we can take in

136
00:13:28,100 --> 00:13:28,940
multiple types.

137
00:13:28,940 --> 00:13:33,350
So now you could do an object or whatever you want.

138
00:13:33,590 --> 00:13:41,120
And I'm sure you're somewhat familiar with the templates by now, but it is important to template some

139
00:13:41,120 --> 00:13:45,350
of your data structures so I can give you that additional functionality.

140
00:13:46,370 --> 00:13:46,880
All right.

141
00:13:47,030 --> 00:13:49,130
See you in the next lecture.
