A std::string is not an open array, you can't just assign to random
non-existing positions.
ok, got it
stripped_word += a_word[ix];
this works. we are just concatenating 2 string objects. right ?
stripped_word.append(a_word[ix]);
[arnuld@arch cpp ]% g++ -ansi -pedantic -Wall -Wextra ex_03-10.cpp
ex_03-10.cpp: In function ‘int main()’: ex_03-10.cpp:21: error: no
matching function for call to ‘std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::append(char&)’
/usr/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/basic_string.tcc:330:
note: candidates are: std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::append(const
std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits
= std::char_traits<char>, _Alloc = std::allocator<char>]
/usr/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/basic_string.tcc:347:
note: std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::append(const
std::basic_string<_CharT, _Traits, _Alloc>&, typename
_Alloc::rebind<_CharT>:
ther::size_type, typename
_Alloc::rebind<_CharT>:
ther::size_type) [with _CharT = char, _Traits =
std::char_traits<char>, _Alloc = std::allocator<char>]
/usr/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/basic_string.tcc:303:
note: std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*, typename
_Alloc::rebind<_CharT>:
ther::size_type) [with _CharT = char, _Traits =
std::char_traits<char>, _Alloc = std::allocator<char>]
/usr/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/basic_string.h:824:
note: std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*) [with
_CharT = char, _Traits = std::char_traits<char>, _Alloc =
std::allocator<char>] <near match>
/usr/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/basic_string.tcc:286:
note: std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::append(typename
_Alloc::rebind<_CharT>:
ther::size_type, _CharT) [with _CharT = char,
_Traits = std::char_traits<char>, _Alloc = std::allocator<char>]
[arnuld@arch cpp ]%
[arnuld@arch cpp ]% g++ --version
g++ (GCC) 4.2.1 20070704 (prerelease) Copyright (C) 2007 Free Software
Foundation, Inc. This is free software; see the source for copying
conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
[arnuld@arch cpp ]%