Re: Returning *this from Glib::Date::add_days() can be useful



On Sun, 2011-03-20 at 19:11 +0100, Kjell Ahlstedt wrote:
> Hi,
> 
> I found the following comment in glibmm/glib/src/date.hg:
> 
>   //TODO: Why return Date& (which is always *this) from these methods?
>   //Isn't it enough to also change the current instance?
>   //murrayc
> 
> An answer is, the return value makes it possible to write statements
> like:
> 
> end_of_terribly_late_project.add_years(2).add_months(3).add_days(17);

Yes, that's useful. Thanks. Noted:
http://git.gnome.org/browse/glibmm/commit/?id=29198769ae1927629186a53642a7de3e13c36c68

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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