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

[18-30] Replace typedefs with alias #704

Merged
merged 1 commit into from Jun 8, 2016

Conversation

AlisdairM
Copy link
Contributor

This set of changes replace (almost) all use of 'typedef' in the library with a type alias instead:
typedef Original NewName; -> using NewName = Original;

Attention was paid to retaining table-like formatting where present, which is worth reviewing in case I made idiosyncratic choices.

Clause 20 has NOT been applied, as that clause is churning a bit at the moment, and I don't want a conflict there to hold up a this review. The most likely conflict is my own pull request:
#683
I will happily rebase and complete the work once that branch lands (or is deferred again until this branch completes)

A second set of changes that should follow are to update the text that refers to typedefs to perhaps use a term more consistent with the type alias syntax applied here - but I defer to the project editors to suggest such phrasing.

@AlisdairM
Copy link
Contributor Author

This pull request addresses #581

@AlisdairM
Copy link
Contributor Author

Note that I can break this down into a dozen distinct file-specific pull requests if that is preferred; the suggestion in the issue is that a single pull large pull request was the way to go though.

The are no changes to clause 19 and 25, and I deliberately stayed out of clause 29 as that clause is deliberately written using C idioms.

@jwakely jwakely self-assigned this Apr 15, 2016
@jwakely
Copy link
Member

jwakely commented Apr 15, 2016

Thanks. I think a single pull request makes more sense. I'll go through this asap and merge.

using const_pointer = typename allocator_traits<Allocator>::const_pointer;
using reference = value_type&;
using const_reference = const value_type&;
using size_type = @\impdefnc@; // see \ref{container.requirements}
Copy link
Contributor

@tkoeppe tkoeppe Apr 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of the non-correcting forms here (i.e. use just \impdef) now that the alignment at the ragged edge doesn't matter anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, you are saying replace '\impdefnc' with '\impdef'?
If so, is that a general rule, or applies only to header synopses and other code snippets?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. "nc" stands for "no (italic) correction", which affects the column alignment. You ought to be able to see the difference (look for how characters (fail to) align on the grid without the correction). But now that the relevant text is at the end of the line, there's nothing left to be aligned, and we don't need to control the italic correction.

That was one of the benefits of changing typedef to using that @zygoloid pointed out in his first email about this subject a few months ago if I recall correctly.

@AlisdairM
Copy link
Contributor Author

AlisdairM commented Apr 16, 2016

Final (I hope!) patch adds the updates for [utility]. I will now wait for this pull request to land before once-again rebasing #683

@tkoeppe
Copy link
Contributor

tkoeppe commented Apr 19, 2016

Can you squash the few fixup commits you have into the respective main commits?

@AlisdairM
Copy link
Contributor Author

Squash them all as a single commit, or just the last couple?

@tkoeppe
Copy link
Contributor

tkoeppe commented Apr 19, 2016

Just the ones that are fixups - 0f6d327 and 8933e27.

(You may wish to first rebase those commits to the front, then reset (= uncommit the changes), then recommit them as small per-file commits, and then "fixup"-rebase those onto their main commits. git rebase -i and git add --patch are your friends.)

@lv-zheng
Copy link

typo in source/support.tex line 132: using is misspelt as ussing

@AlisdairM AlisdairM force-pushed the replace_typedefs_with_alias branch from 8933e27 to 9e71133 Compare May 24, 2016 14:46
@AlisdairM
Copy link
Contributor Author

AlisdairM commented May 24, 2016

Fixed the typo (thanks lv-zheng) and force-pushed a single squash-commit of the whole branch. No other changes.

@zygoloid
Copy link
Member

I want to go ahead with this, but not until after Oulu. Sorry if this requires extra rebasing as a result!

@tkoeppe
Copy link
Contributor

tkoeppe commented May 31, 2016

@zygoloid: Last standard, you didn't want to make major formatting changes after the CD had gone out (e.g. I remember fixing up the vertical whitespace problems with the old heading styles to be one such change). Will there still be room for changes like this after Oulu? Will you only create the CD after the meeting?

@AlisdairM
Copy link
Contributor Author

AlisdairM commented Jun 1, 2016

If we plan to land this after Oulu, is there anything I can do to land it /before/ papers start landing from the meeting. It will be much easier to update the standard for incoming papers with this in place (and editorial discretion when applying updates) than taking another pass to totally redo the work, at an undetermined time after all Oulu papers have landed again.

I will try to rebase and get another clean version up tonight, regardless.

@zygoloid
Copy link
Member

zygoloid commented Jun 1, 2016

If we're going to land this before we land the Oulu motions, we may as well do so now. I think you're right, handling the merge as Oulu motions land is not going to be very difficult. (Sorry for not merging this sooner, I'd missed that the pre-Oulu mailing deadline was 2pm not end-of-day, and was putting together the new working draft in a bit of a rush.)

using reference = typename Container::reference;
using const_reference = typename Container::const_reference;
using size_type = typename Container::size_type;
using container_type = Container;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove the whitespace before Container here. Now that we're not aligning anything else after the =, this looks a bit odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like my 2-dimensional code :) But defer to the actual project editor on style choice - will update this tonight.

@AlisdairM AlisdairM force-pushed the replace_typedefs_with_alias branch from 9e71133 to 50e43e5 Compare June 1, 2016 23:56
@AlisdairM
Copy link
Contributor Author

Corrected Richard's issues above, and deployed the \grammarterm{typedef-name}{s} in several other places. Tried to avoid reformatting around long lines, but at least one paragraph was re-wrapped.

Rebased, squashed, and --force pushed again.

using char_type = charT;
using traits_type = traits;
using streambuf_type = basic_streambuf<charT,traits>;
using ostream_type = basic_ostream<charT,traits>;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please align this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased again (just to be safe) and aligned the line highlighted above - should land cleanly.

    This set of changes replace (almost) all use of 'typedef' in the library
    with a type alias instead:
        typedef Original NewName;
     ->
        using NewName = Original;

    Attention was paid to retaining table-like formatting where present, which
    is worth reviewing in case I made idiosyncratic choices.

    Clause 29 [atomic] was specifically ignored, as there is a desire for the
    contained code to look as close to a C compatible header as possible.
@AlisdairM AlisdairM force-pushed the replace_typedefs_with_alias branch from 50e43e5 to f2d8a8e Compare June 7, 2016 22:39
@zygoloid zygoloid merged commit c8f1863 into cplusplus:master Jun 8, 2016
@AlisdairM AlisdairM deleted the replace_typedefs_with_alias branch June 8, 2016 14:33
burblebee pushed a commit that referenced this pull request Jun 22, 2016
Replaced typedef with using as per:
[18-30] Replace typedefs with alias-declarations (#704)
burblebee pushed a commit that referenced this pull request Jun 23, 2016
Replaced typedef with using as per:
[18-30] Replace typedefs with alias-declarations (#704)
burblebee pushed a commit that referenced this pull request Jun 27, 2016
Replaced typedef with using as per:
[18-30] Replace typedefs with alias-declarations (#704)
burblebee pushed a commit that referenced this pull request Jun 27, 2016
Replaced typedef with using as per:
[18-30] Replace typedefs with alias-declarations (#704)
burblebee pushed a commit that referenced this pull request Jun 29, 2016
Replaced typedef with using as per:
[18-30] Replace typedefs with alias-declarations (#704)
zygoloid pushed a commit that referenced this pull request Jul 4, 2016
Replaced typedef with using as per:
[18-30] Replace typedefs with alias-declarations (#704)
FrankHB pushed a commit to FrankHB/draft that referenced this pull request Jul 9, 2016
This set of changes replace (almost) all use of 'typedef' in the library
    with a type alias instead:
        typedef Original NewName;
     ->
        using NewName = Original;

    Attention was paid to retaining table-like formatting where present, which
    is worth reviewing in case I made idiosyncratic choices.

    Clause 29 [atomic] was specifically ignored, as there is a desire for the
    contained code to look as close to a C compatible header as possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants