Quantcast
Channel: Comments on: 9.8 — Overloading the subscript operator
Browsing latest articles
Browse All 240 View Live

By: Rushhahb

I agree but I am sure you are very genius!

View Article



By: nascardriver

Binary search can be implemented without the temporary object, but there is no standard algorithm that does this. The reason for there not being such an algorithm might be that `std::binary_search`...

View Article

By: SaMIRa

Thank you one thousand times <3 <3

View Article

By: Michael

Hi there! I am trying to overload the subscript operator in a templated Array class that I created but I am getting a linker error. I am able to get it to work if I define the function inside the class...

View Article

By: Eric

In reference to quiz 1.c can you clarify what's happening here?: 1 m_map.push_back({ name }); //name is reference to StudentGrade.name and is a string can we push_back a just one element of struct...

View Article


By: nascardriver

You can't define template functions in source files with their declaration being in the header unless you explicitly instantiate them, which defeats the purpose of using a template. Define the...

View Article

By: nascardriver

We can construct a student by using only a part of its members 1 Student eric{ "eric" }; // grade is initialized with the value given in the struct definition The same is happening when we use list...

View Article

By: Michael

Perfect, thank you! Should have looked more closely at the template section I guess :P

View Article


By: CC

In your example of overloading `operator[]` to take string indices (and, indeed, in pretty much every other example prior where you overload an operator using member functions), you declare the...

View Article


By: nascardriver

There's no point in doing so in this example. In practice, classes get separated into header and source file, so there'll rarely be function definitions in the class definition.

View Article
Browsing latest articles
Browse All 240 View Live




Latest Images