We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0915e25 commit 417da74Copy full SHA for 417da74
CppCoreGuidelines.md
@@ -4878,14 +4878,16 @@ It's the simplest and gives the cleanest semantics.
4878
4879
struct Named_map {
4880
public:
4881
- Named_map() : name("empty") {}
4882
- // ... no default operations declared ...
+ Named_map(const string& n) : name(n) {}
+ // no copy/move constructors
4883
+ // no copy/move assignment operators
4884
+ // no destructor
4885
private:
4886
string name;
4887
map<int, int> rep;
4888
};
4889
- Named_map nm; // default construct
4890
+ Named_map nm("map"); // construct
4891
Named_map nm2 {nm}; // copy construct
4892
4893
Since `std::map` and `string` have all the special functions, no further work is needed.
0 commit comments