C++ 从C+中的实现调用模板化类是否正确+;

C++ 从C+中的实现调用模板化类是否正确+;,c++,c++11,c++14,C++,C++11,C++14,我正在从实际实现中调用模板化类 模板化类: #include <iostream> #include <list> template <typename Argone, typename Argtwo> class CTestImpl { public: void CTestImpl::handleEvents(Argone f_strID, Argtwo f_obj)

我正在从实际实现中调用模板化类

模板化类:

    #include <iostream>
    #include <list>
    
    template <typename Argone, typename Argtwo>
    class CTestImpl
    {
    
    public:
        void CTestImpl::handleEvents(Argone f_strID, Argtwo f_obj)
        {
           m_hvar->sendEvents(f_strID, f_obj);
        }
    };

    string l_strID;
    shared_ptr<CMainImplone> l_hCallObj = nullptr;
    
    shared_ptr<CTestImpl<string, shared_ptr<CMainImplone>>> l_listObj = nullptr;
    l_listObj->handleEvents(l_strID, l_hCallObj);


这样从实现中调用模板类是否正确?

请注意
l\u listObj->handleEvents(l\u strID,l\u hCallObj)在对空指针调用成员函数时具有未定义的行为。您的示例不是有效的代码。您不能将
CTestImpl::handleEvents
定义为类主体中的内联函数,这使您看起来可能定义得太过分了,如果从模板实例化的角度看,
handleEvent
的定义是可见的,那么这是很好的。请提供并描述您试图实现的功能类型,因为对我来说这看起来像。

    int l_iD;
    shared_ptr<CMainImpltwo> l_hCallObj = nullptr;
    
    shared_ptr<CTestImpl<int, shared_ptr<CMainImpltwo>>> l_listObj = nullptr;