Let\'s say I have
#include
#include
using namespace std;
struct Student
{
const string name;
int grade;
Student(co
The simple answer is: you can't. If you have const member variables, then the compiler can't supply a default copy-assignment operator. However, many of the operations that std::vector provides need to make assignments, and therefore require a (public) copy-assignment operator.
Your options are:
name non-const.const member.