Does the use of templates support memory

In my understanding, Templates allow us to write a single function or class that works for different data types.

Containers, such as a stack or linked lists, are used to store data, but can store one type of data at a time. To store different types of data in storage, we must write different versions of the same container class. We can keep this code repetition by writing a class template.

I know that it saves the effort of writing part of the programmer. but I want to know that using patterns saves memory or not.

+4
source share
5 answers

, . , , . , , . .

, , . , , . int float? stl . ! , . void.

, , - . , - .

, . - . - .

: 3 , .

+2

. / , , .

0

, , , . , , , . , .

. , , , STL. STL , , ..

, . , , , , .

, , , , . ++, , - .

, OO, , . , .. .

, , , , , - . , .

0

, . , .

, ...

, , - , . ( ) , . , .

, .

, . : ++?, ++ : . / .

0

? ? ?

. , . , , , , .

. , . - . , . . , , .

std::list, . , . . .

. .

-1
source

All Articles