Re: New compose and format API

On 8/14/07, Daniel Elstner <daniel kitta googlemail com> wrote:
> Am Dienstag, den 14.08.2007, 13:28 -0500 schrieb Jonathon Jongsma:
> > I already gave my opinion to Daniel on IRC, but I thought I'd post
> > here as well in case others want to weigh in.  My preference is
> > currently for option 3.  I think the desire to make the interface
> > similar to boost is laudable, but I personally find the 'function
> > argument' syntax much more readable than the operator% overloading.
> > But I do agree that for the common case of passing a plain string or
> > number (i.e. without any manipulators), it would be nice to drop the
> > extra ustring::format() call.
> Done.  The API now looks like this:
>   s = ustring::compose("%1 is lower than %2.",
>                        12, ustring::format(std::hex, 16));

That looks nice to me.

> I opted to keep the method names compose() and format() rather than
> switching to the boost names format() and group().  Since format() can
> be used without compose() it would be strange to call it group():
>   s = ustring::format(12.3);

I agree with this decision as well.  ustring::format() will be a
useful little function on its own as well.


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