Project

General

Profile

Actions

Task #2022

closed

code-style: short methods in class declaration

Added by Junxiao Shi about 10 years ago. Updated about 10 years ago.

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

0%

Estimated time:
1.50 h

Description

Update code-style.rst to establish a guideline to choose between these two styles on short methods:

Definition inside class declaration:

class C : noncopyable
{
public:
  int
  getN() const
  {
    return m_n;
  }

private:
  int m_n;
};

Definition outside class declaration:

class C : noncopyable
{
public:
  int
  getN() const;

private:
  int m_n;
};

inline int
C::getN() const
{
  return m_n;
}

This guideline is necessary to ensure consistency in code style.

Actions

Also available in: Atom PDF