Search code examples
c++language-lawyervirtual-functionsstdpure-virtual

Is there a pure virtual function in the C++ Standard Library?


In Nicola Gigante's lecture in 2015, he mentions (at the beginning) that there are no pure virtual functions in the Standard Library (or he's not aware of any). I believe that Alex Stepanov was against this language feature but since the initial STL design, have any pure virtuals creeped into the Standard library?

FWIW (and correct me if I'm wrong) the deleters in unique pointers ultimately use virtual dispatching in most implementations but these are not pure virtuals.


Solution

  • [syserr.errcat.overview] has std::error_category

    class error_category {
      virtual const char* name() const noexcept = 0;
      virtual string message(int ev) const = 0;
    };
    

    There are no others in C++14.