Re: New compose and format API
- From: Ole Laursen <olau hardworking dk>
- To: gtkmm-list gnome org
- Subject: Re: New compose and format API
- Date: Wed, 05 Sep 2007 10:17:10 +0200
Paul Davis <paul linuxaudiosystems com> writes:
> Ole, the Ardour project has been using your "library" for a long time
> (though we chose to call "compose" "string_compose" to avoid endless
> namespace classes with ustring/boost etc). we recently added the crusty
> old C++ "to_string()" cf:
>
> template <class T> std::string
> to_string (T t, std::ios_base & (*f)(std::ios_base&))
> {
> std::ostringstream oss;
> oss << f << t;
> return oss.str();
> }
>
> other than its potential inefficiences, what are the defects with this?
Also it might bite you if you use it in other locales. I had a problem
with a truncated thousands separator in I think it was Finnish because
std::ostringstream is supposed to contain chars and the thousands
separator might be too large to fit in a char (because it might be
something else than ',' or '.'). So the standard library simply
truncates it. The result is invalid UTF-8, and then GTK+/gtkmm freaks
out.
--
Ole Laursen
http://people.iola.dk/olau/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]