Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decide how to indent class template definitions #1754

Closed
tkoeppe opened this issue Sep 24, 2017 · 5 comments
Closed

Decide how to indent class template definitions #1754

tkoeppe opened this issue Sep 24, 2017 · 5 comments
Labels
big An issue causing a large set of changes, scattered across most of the text.

Comments

@tkoeppe
Copy link
Contributor

tkoeppe commented Sep 24, 2017

We currently have several different styles of indenting class template definitions. Usually, every "structural" line break causes an extra indent level, like we have in synopses:

namespace std {
  template <typename T>
    class foo;
}

But when it comes to definitions, we sometimes follow this convention and othertimes we violate it:

  1. "No linebreak after template":

    namespace std {
      template <typename T> class foo {
      public:
        void bar();
      };
    }
    
  2. "linebreak and indent":

    namespace std {
      template <typename T>
        class foo {
        public:
          void bar();
        };
    }
    
  3. "linebreak with no indent":

    namespace std {
      template <typename T>
      class foo {
      public:
        void bar();
      };
    }
    

Of these three options, (1) and (2) seem the most consistent. Option (1) is not always feasible when the template parameter list is long. However, option (3) is used a lot, especially in the older parts of the text (e.g. [containers]).

For now, I will probably retain the local style, though if I need to add missing namespace std {s and the indentation changes, I might as well remove instances of (3). But it would be good to decide on a definite style and record that in the wiki. (My vote would be to allow only (1) and (2).)

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Oct 13, 2017
@jensmaurer
Copy link
Member

jensmaurer commented Nov 7, 2017

Editorial meeting consensus: 1 and 3 for definitions and 1 and 2 for non-defining declarations. Also have line breaks between definitions.

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Nov 7, 2017
@jensmaurer
Copy link
Member

jensmaurer commented Feb 16, 2018

This seems to override the decision in #1576 and address #1516.

@jensmaurer
Copy link
Member

When performing any changes, make sure to also consider "namespace std" wrappers: #1168.

@jensmaurer jensmaurer added the big An issue causing a large set of changes, scattered across most of the text. label Feb 16, 2018
@jensmaurer
Copy link
Member

Let's double-check our decisions in Jacksonville (cognizant of earlier wobbling) before embarking on a harmonization frenzy.

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Feb 16, 2018
@tkoeppe
Copy link
Contributor Author

tkoeppe commented Mar 17, 2018

Decision confirmed with @zygoloid. I updated the wiki to replace contradictory information with guidance that matches this decision.

@tkoeppe tkoeppe closed this as completed Mar 17, 2018
@tkoeppe tkoeppe removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Mar 17, 2018
tkoeppe added a commit that referenced this issue Apr 2, 2018
E.g. apply guidance from #1754, adjust comment columns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
big An issue causing a large set of changes, scattered across most of the text.
Projects
None yet
Development

No branches or pull requests

2 participants