i think called temporary object. here scenario:
i have functions:
void list<t>::remove(listiterator &) listiterator list<t>::begin() //returns iterator pointing first node in list.
in g++ when try this:
mylist.remove(mylist.begin())
i following error:
no matching function call remove(listiterator).
i don't have function takes listiterator value , nor want one. i'm not sure if i'm trying makes sense. code works on windows vs2012 not in g++.
any advice on how either fix implementation or explanation of behaviour appreciated!
the results of mylist.begin()
temporary (unless mylist.begin()
returns reference). can't use temporary initialize non-const reference. either assign results variable, , pass remove
, make reference const, or use pass value.
as why vs2012 compiles it: vs2012 isn't conform.
Comments
Post a Comment