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



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]