This question has already been answered:
- Books and learning resources in C ++ 1 answer
Functions of this kind, which topic is c ++ where to find out? what to read? that's exactly when indicated in parentheses <int>.
Memory.Read<int>(0x76999A1); This question has already been answered:
Functions of this kind, which topic is c ++ where to find out? what to read? that's exactly when indicated in parentheses <int>.
Memory.Read<int>(0x76999A1); Template function
The data type is indicated in the "triangular brackets" a great example is the sort of "bubble"
template < class T > //T это тип передаваемых данных void bubbleSort (T* a, long size) { long i, j; T x; for (i = 0; i < size; i++) { for (j = size - 1; j > i; j--) { if (a[j - 1] > a[j]) { x = a[j - 1]; a[j - 1] = a[j]; a[j] = x; } } } } Called template functions like this:
bubbleSort<int>(arr, 5); Where in triangular brackets we transfer data type.
All is clearly shown in the finished code.
#include <iostream> using namespace std; template < class T > //T это тип передаваемых данных void bubbleSort (T* a, long size) { long i, j; T x; for (i = 0; i < size; i++) { for (j = size - 1; j > i; j--) { if (a[j - 1] > a[j]) { x = a[j - 1]; a[j - 1] = a[j]; a[j] = x; } } } } int main () { int arr[5] {1, 3, 2, 5, 4}; cout << "Non-sorted" << endl; for (int i = 0; i < 5; i++) { cout << arr[i] << endl; } bubbleSort<int>(arr, 5); // в треугольных скобках мы передаем тип данных int cout << "Sorted" << endl; for (int i = 0; i < 5; i++) { cout << arr[i] << endl; } return 0; } As a result, we get the following conclusion:
Non-sorted 1 3 2 5 4 Sorted 1 2 3 4 5 int - ishidex2Below are links where you can read about them:
The first two links are a simple introduction, the third is an article on Wikipedia (useful, but a bit more complicated).
The last two - there is a lot of useful information, if you need to study more deeply, I strongly advise. (do not pay attention to the name, it has no purpose to offend anyone;))
Source: https://ru.stackoverflow.com/questions/812384/
All Articles