Returning *this from Glib::Date::add_days() can be useful
- From: Kjell Ahlstedt <kjell ahlstedt bredband net>
- To: gtkmm-list gnome org
- Subject: Returning *this from Glib::Date::add_days() can be useful
- Date: Sun, 20 Mar 2011 19:11:11 +0100
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]