search for: getsecondptr

Displaying 1 result from an estimated 1 matches for "getsecondptr".

2009 Feb 18
2
[LLVMdev] Parametric polymorphism
...ns. The second problem with C++ templates is that every template instantiation always generates completely new code, even when it doesn't need to. Consider the following two functions: struct PairPtr<T> { T* first, T* second }; struct Pair<T> { T first, T second }; T* getSecondPtr<T>(PairPtr<T>* pair) { return pair->second; } T getSecond<T>(Pair<T>* pair) { return pair->second; } The generated code for getSecondPtr() is the same for every T. There is absolutely no need to generate a bazillion specialized copies. Notice that the .Net value-...