Funny thing about glib::ustring::substr(i, n)



Hi List.

In the following code the if branch never gets entered:

void somefunc(void)
{
  Glib::ustring str = "This is some text";
  if ( str.substr(0,4) == "This" )
  {
    std::cout << "if branch entered" << std::endl;
  }
  else
  {
    std::cout << "else branch entered" << std::endl;
  }
}

If you replace Glib::ustring with std::string the if branch will be executed.


Is this a bug or am I confusing something?

Just for the files: I'm using gtkmm-2.2.12 on MSVC running upon a GTK+-2.4.0
(without any other known problems).

Regards,

DJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]