Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::trim throwing std::bad_cast exeption with custom basic_string
From: Arash Abghari (arash.abghari_at_[hidden])
Date: 2011-01-23 01:06:47


On Sat, 22 Jan 2011 20:08:48 +0200
Igor R <boost.lists_at_[hidden]> wrote:

> > I have a custom basic_string as follows:
> >
> > typedef basic_string<unsigned int> ustring;
> >
> > so if I pass an instance of ustring to boost:trim it throws an
> > std::bad_cast exception.
> >
> > ustring str;
> > boost::trim(str);
>
> It doesn't raise exceptions on MSVC10, so I guess the problem is in
> the standard library implementation you use.
Thanks for your reply. I think I made a mistake on providing with the
example. It doesn't throw an exception if str is empty. Could you try
this:

typedef basic_string<int> ustring;
ustring str(2,0x61);
boost::trim(str);

this is throwing an exception. I tried it with boost 1.40 and 1.42.

BTW, which version of boost you are testing on?

> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net