Project

General

Profile

Feature #4681

code-style 2.24: update example with using base class constructor

Added by Junxiao Shi over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Docs
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
1.50 h

Description

rule 2.24 currently gives the following example:

#include <stdexcept>

class Foo
{
  class Error : public std::runtime_error
  {
  public:
    explicit
    Error(const std::string& what)
      : std::runtime_error(what)
    {
    }
  };
};

Since C++14, this can be simplified as:

#include <stdexcept>

class Foo
{
  class Error : public std::runtime_error
  {
  public:
    using std::runtime_error::runtime_error;
  };
};
#1

Updated by Junxiao Shi over 2 years ago

  • Status changed from New to Code review
  • Assignee set to Junxiao Shi
  • % Done changed from 0 to 100
#2

Updated by Junxiao Shi over 2 years ago

  • Status changed from Code review to Closed

Also available in: Atom PDF