Reputation: 11399
I am trying to add a struct to a vector of structs.
vector<udtWChar2> n;
vector<udtTag>_tags;
for (unsigned t=0;t<_tags.size();t++)
{
udtTag &nt=_tags[t];
for (int i=nt.PosStartTag;i<nt.PosStartTag+nt.CoveredLen;i++)
{
n[i].Tags.push_back[nt];
}
}
The error I am getting is in the line
n[i].Tags.push_back[nt];
"A pointer to a bound function may only be called to invoke the function".
Here are my declarations:
struct udtTag
{
int PosStartTag;
int LenStartStart;
int PosEndTag;
int LenEndTag;
int CoveredLen;
eTagType Type;
wstring Value;
};
struct udtWChar2
{
wstring Text;
int OrigPos;
int AbsSpeed;
int Bookmark;
bool IsTag;
vector<udtTag>Tags;
};
I don't see what I did wrong. Can somebody please help? Thank you.
Upvotes: 0
Views: 156
Reputation: 5721
The expression Tags.push_back[nt]
is not a call of method push_back
. The compiler thinks you want to call push_back.operator[]
. Replace the square brackets with parentheses:
... Tags.push_back(nt);
Upvotes: 2