From 61018eeaae78cdb436540f719c43fab98db51e8b Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 12 Dec 2019 14:19:45 -0800 Subject: [PATCH] Updated FAQ (markdown) --- FAQ.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/FAQ.md b/FAQ.md index a6da11e..08077e2 100644 --- a/FAQ.md +++ b/FAQ.md @@ -27,29 +27,29 @@ The programmer would probably use it like this: year_month_day get_meeting_date(year y, month m) { - return year_month_day{tue[3]/m/y + days{1}}; + return year_month_day{Tuesday[3]/m/y + days{1}}; } That is super-compact syntax! Here is what it costs: -1. Convert `tue[3]/m/y` (`year_month_weekday`) to `sys_days` in order to add `days`. +1. Convert `Tuesday[3]/m/y` (`year_month_weekday`) to `sys_days` in order to add `days`. 2. Convert the `sys_days` computed back to `year_month_weekday`. 3. Convert the temporary `year_month_weekday` computed in 2 back to `sys_days`. 4. Convert the `sys_days` to a `year_month_day`. 4 conversions. -Here is the way you have to write this function today (because `tue[3]/m/y + days{1}` is a compile-time error): +Here is the way you have to write this function today (because `Tuesday[3]/m/y + days{1}` is a compile-time error): year_month_day get_meeting_date(year y, month m) { - return year_month_day{sys_days{tue[3]/m/y} + days{1}}; + return year_month_day{sys_days{Tuesday[3]/m/y} + days{1}}; } The syntax is slightly more verbose in that you have to explicitly convert the `year_month_weekday` into a `sys_days` in order to perform the day-oriented arithmetic. Here is what it costs: -1. Convert `tue[3]/m/y` (`year_month_weekday`) to `sys_days` in order to add `days`. +1. Convert `Tuesday[3]/m/y` (`year_month_weekday`) to `sys_days` in order to add `days`. 2. Convert the `sys_days` to a `year_month_day`. 2 conversions. Roughly twice as fast!