User Profile

Collapse

Profile Sidebar

Collapse
skydoom
skydoom
Last Activity: Mar 27 '08, 03:31 PM
Joined: Oct 10 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • I had fingered out what I should do now :)

    Indeed, I initially want some 'partial template specialization' for the template function, which is not currently supported in the C++ standard(which _might_ be in the next C++0x). But I do find some workaround for that:

    // declare a template class with a friend template function.
    template<typena me B, typename D>
    class mycast{
    friend D* fun_cast<B,D>(B *...
    See more | Go to post

    Leave a comment:


  • How to specialized the template function when its parameter type are same?

    template <class A, class B> inline B* mycast( A* a)
    {
    return dynamic_cast<B> (a);
    }

    // try to specialize the mycast to handle when B==A, such as:
    template <class A> inline A* mycast(A* a)
    {
    return a; // since type B is identical to A.
    }
    // OR what else I should do to implement this function??????

    //....somewhere we try to use mycast()...
    See more | Go to post
No activity results to display
Show More
Working...