s.insert(0,1,' ');because there is an ambiguity between the following two member functions:
insert(size_type idx, size_type num, charT c);
insert(iterator pos, size_type num, charT c);
when iterator is implemented as char*.Note that 0 is a valid size_type and a valid char*.
s.insert(static_cast(0),1,' ');
would fix the ambiguity.Reference: The C++ Standard Library: A Tutorial and Reference

No comments:
Post a Comment