Menu

Trouble with forward cosntructor

Robert Hue
2017-11-07
2017-11-07
  • Robert Hue

    Robert Hue - 2017-11-07

    Hello,

    Here is a following constructor :

    template <typename... Args>
    MyClass(Args&&... args) : T(std::forward<Args>(args)...) {}
    

    That causes a CppCheck error :

    CppCheck: style - noExplicitConstructor: Class 'MyClass' has a constructor with 1 argument that is not explicit.

    I use CppCheck 1.80.

     
  • Robert Hue

    Robert Hue - 2017-11-07

    Finally it seems it does make sense to put the explicit keyword in front of a such constructor.
    So this is not a CppCheck bug. Sorry.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.