I'm learning c++ and was playing around with macros. I tried defining push_back as pub, and it gave me this error:
error: reference to non-static member function must be called
vect.pub(1);
Here's my code:
#include <vector>
using namespace std;
typedef vector<int> vi;
#define pub push_back;
int main(){
vi vect;
vect.pub(1);
}
When I didn't use the #define
and just wrote push_back
, there was no error messages.
What exactly changed when I used the macro?