Должны ли мы предоставить деструктору спецификатор no-throw?

namespace QuantLib {

    //! Base error class
    class Error : public std::exception {
      public:
        /*! The explicit use of this constructor is not advised.
            Use the QL_FAIL macro instead.
        */
        Error(const std::string& file,
              long line,
              const std::string& functionName,
              const std::string& message = "");
        /*! the automatically generated destructor would
            not have the throw specifier.
        */
        ~Error() throw() {}
        //! returns the error message.
        const char* what() const throw ();
      private:
        boost::shared_ptr<std::string> message_;
    };

}

Как вы видите из комментария, деструктор класса Errorявно предоставляет пустую реализацию со спецификатором no-throw.

Вопрос: Нужно ли это? Или это хорошая практика по сравнению с тем, чтобы позволить компилятору генерировать неявный деструктор?

8
задан iammilind 11 October 2012 в 05:33
поделиться