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:
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:
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 amap<string, string>alias would work out just fine, too.Reference: