3 ms·
If you have e.g. a *string you can't populate it with &"hello world." You have to first assign the string to a variable and then take the address of that variab
by closeparen 5y ago
If you have e.g. a *string you can't populate it with &"hello world." You have to first assign the string to a variable and then take the address of that variable. This comes up very often in tests and is super inconvenient. Many people write TypeNamePtr functions so that you can call e.g. StringPtr("hello world") to express it in one line and without creating any names. Without generics you had to do this individually for every type.