locked
specialization of template function problem RRS feed

  • Question

  • hi
    I have following code compiling correctly in VS6.0

    template <typename T>
    void Watermark(T * const target)
    {                       
        // This function must be specialized!!!
        Ensure(false);
    }

    and function specilization as
    void Watermark<tHtmlPage>(tHtmlPage * const pPage);

    the VS2008 gives following error

    Error    42    error C2768: 'Watermark' : illegal use of explicit template arguments    c:\hemant\ns\build_1.5.1.269\build_1.5.1.269\source\appframe\WatermarkPage.h    44    Appframe

    how to fix it
    Wednesday, June 24, 2009 3:11 AM

Answers

  • It's ambiguous, could be an explicit specialization, could be a new function.  Fix:

    template<>
    void Watermark<tHtmlPage>(tHtmlPage * const pPage);

    Hans Passant.
    Wednesday, June 24, 2009 3:38 AM