Issue on add cpp definition from header



  • I have a case where refactoring and the helper to create the cpp definition from the header is wrong.
    Here a case :

    @ template <typename T>
    struct EvtType {

    //! Result type.
    typedef T const & R;
    };@

    @void foo(EvtType<int>::R var);@

    When I want to create the definition or use the refactoring helper, I’ve :

    @void foo(EvtType::R var)
    {

    }
    @

    in my cpp file. It miss the template paramater.

    Another point concerning the helper to create the cpp definition,
    I really want a keyboard shortcut for that ;)

    Thanks for this nice IDE,
    Firebird


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    template functions must have their body in the same file as their declaration. So you have to keep it in the header

    What shortcut do you mean ? Depending on it you can fill a feature request "here":http://bugreports.qt-project.org but check first if somebody already did



  • Hi SGaist, and thank-you.

    In my case its a template struct, not a function. And I relate an issue of qt creator code assistance.

    For the shortcut I request, it is for the action on the contextual menu of the text editor, "Refactor" -> "Add definition to xxxx.cpp".


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.