Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template all heap code #89

Closed
mpadge opened this issue Apr 5, 2019 · 1 comment
Closed

template all heap code #89

mpadge opened this issue Apr 5, 2019 · 1 comment

Comments

@mpadge
Copy link
Member

mpadge commented Apr 5, 2019

Current hard-coded for <double>, but should be templated to allow for more efficient processing of <int> values.

@mpadge
Copy link
Member Author

mpadge commented May 10, 2019

Can't really be done in any efficient way, because the different heaps all rely on

template <class T>
class HeapD: public HeapDesc {
    public:
        Heap *newInstance(unsigned int n) const { return new T(n); }
};

all instantiated via

std::shared_ptr <HeapDesc> run_sp::getHeapImpl(const std::string& heap_type) {
    ...
    return std::make_shared <HeapD<BHeap> >();
}

and the object in the shared pointer can NOT itself be templated, so BHeap can not, in this case, be templated, but must be an explicit instantiation. Anyway, values are surely almost always going to be real rather than int, and it'll be easier to implement a separate and explicit <int> version for centrality calculations of #90.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant