| |

VerySource

 Forgot password?
 Register
Search
Author: zjzengjian

Discussion: Is template technology just a class library?

[Copy link]

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 01:00:01
| Show all posts
[Quote=Quote the reply fromkillersson the 5th floor:]
. . . The fundamental purpose of template is source level re-use, and source level re-use is only a (partial) feature of library. The application emphasizes the delivery the functionality to the user. As for the specific technology and means, it is not important at all.
[/Quote]
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 01:15:01
| Show all posts
mark learning!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 02:15:01
| Show all posts
This post is very promising, and it will definitely usher in countless masters, and the poor will occupy the first place.
Reply

Use magic Report

0

Threads

55

Posts

44.00

Credits

Newbie

Rank: 1

Credits
44.00

 LAN

Post time: 2020-8-28 06:30:01
| Show all posts
The key is how high a level of abstraction you need.
The larger and more versatile, the more the advantages of the template can be used.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-2 21:15:01
| Show all posts
Good post
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-2 21:30:02
| Show all posts
I am learning C++ templates and I already have a certain understanding of templates. I don't want to read C++ templates, boost, and loki. The main reason is that I think this template is not very useful. But I was ashamed, so when I searched it today, I found someone to discuss here. Indeed pointed me the direction.
Based on the comments made by everyone above, I come to this conclusion:
The application of OO is to describe such a thing. People can eat, I am a human, so I can eat, and because of the virtual existence, everyone can eat differently. OO must be of the same kind, and OO achieves compression of the same kind of behavior.
What GP said is that you can eat, and I can also eat, even if we don’t matter. People can eat, dogs can eat, and even machines have to eat. I can let them all eat here. GP does not matter which type you have, GP implements compression of different kinds of behaviors.
These two things, one vertical and one horizontal, are not contradictory. OO is omnipotent. GP that OO can do can’t be done, and OO that GP can do can also do awkward OO (different types of brothers let you be the same, Java.NET, there was no GP before, so they should all belong to this category) , But this consumes performance, clarity and maintainability. So some things still need GP to do, especially in the case of high cross-type compression requirements, or even infinite types. In this case, it is too troublesome to use GP. Let us inherit a bunch of interfaces for each class. Trouble, it's better to use it directly without inheritance (where GP is useful). We must let the compiler write the program for us (I think GP is essentially the compiler writes the program for us-instantiation).
In fact, macros can also GP, and template is a smarter GP that saves coders and is safer.

Specific to the actual development, there is no doubt that the general library we work on is the universal library we work on for infinite types, so GP uses a lot here; and we seldom use this for each enterprise application development project. GP. There are not so many different types of peers! In our development, there is no "dog and person eating" situation, but most of them are "this person eating with that person" situation. And the code logic is the most variable part. Too far away from GP.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list