Skip to content

Check special member generation for mistakes in implicitely generated ones #1689

@daniel-j-h

Description

@daniel-j-h

See for eample server/http/header.hpp: writing special members is horrible here.

There are rules on how the compiler generates special member functions.
You have to understand them. You really have to understand them.

Check Howard Hinnant's talk slides in the references (he's the libc++ dev).
Read it, understand it, and then print out page 28. Seriously, just do it.

For the example above, the best solution is this:

struct header { std::string name, value; };

Tada, the compiler does the rest!
Isn't this awesome and so much more clear then trying to write them manually?

Note: a pair<string, string> or then a map<string, string> alias would work out just fine, too.

Reference:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions