From ef021857883fc257989d41b48a46adbc3ee34572 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 12 Dec 2019 14:50:56 -0800 Subject: [PATCH] Updated FAQ (markdown) --- FAQ.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/FAQ.md b/FAQ.md index dbf80e1..579b454 100644 --- a/FAQ.md +++ b/FAQ.md @@ -54,6 +54,14 @@ The syntax is slightly more verbose in that you have to explicitly convert the ` 2 conversions. Roughly twice as fast! And the code generation (using clang++ -O3) is roughly half the size: 152 assembly statements vs 335 assembly statements. +Finally, one can take advantage of the fact that the conversion from `sys_days` to `year_month_day` can be made implicitly, and so one can further simplify the syntax (this change does not impact code generation): + + year_month_day + get_meeting_date(year y, month m) + { + return sys_days{Tuesday[3]/m/y} + days{1}; + } + This philosophy is similar to that which we have for containers: It would be super easy to create `vector::push_front(const T&)`. But that would make it too easy for programmers to write inefficient code. The compiler helps remind the programmer that perhaps `deque` or `list` would be a better choice when he attempts to code with `vector::push_front(const T&)`. It would be very easy to add `T& list::operator[](size_t index)`. But that would encourage the programmer to use `list` when a random-access container would probably be more appropriate for the task.