c++ - Please teach me how to make the template parameters of a following function -
i beginner of template. want make function template template parameters. me, complicated template template parameter. , cannot make it. someone, please let me know how can make it. thank much.
class vertex { }; main() { std::vector<std::shared_ptr<vertex>*> vertexes_a, vertexes_b; comparevector(&vertexes_a, &vertexes_b); } /* made following template parameters. compiler cannot compile it. * said template parameters invalid... must have stupid understanding. * please ignore template parameters , * please teach me how make template parameters. */ template <typename elm, template<template<elm> class sharedptr, typename allocator=std::allocator<template<elm> class sharedptr> > class stl> bool comparevector(stl<std::shared_ptr<elm>>* org, stl<std::shared_ptr<elm>>* cmp) { }
thank much.
maybe want this?
template <template <typename ...> class c, typename ...args> bool comparevector(c<args...> const * lhs, c<args...> const * rhs) { // ... }
if want work vectors:
template <typename t, typename a> bool comparevector(std::vector<t, a> const * lhs, std::vector<t, a> const * rhs);
if want work arbitrary template classes first template argument template class 1 argument (but why):
template <template <typename ...> class c, template <typename> class sp, typename t, typename args...> bool comparebizzare(c<sp<t>, args...> const * lhs, /* ... */);
note none of desired function arguments specializations of template has template template parameters. standard library not contain templates take template template parameters (for now).
Comments
Post a Comment