Timeline for Project Euler 001 in C++
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Jun 28, 2018 at 11:29 | history | suggested | Fifoernik | CC BY-SA 4.0 |
Corrected a typo introduced by Toby Speight's edit.
|
Jun 28, 2018 at 10:30 | review | Suggested edits | |||
S Jun 28, 2018 at 11:29 | |||||
Jun 22, 2018 at 20:01 | comment | added | 0x5453 | @papagaga At least in certain cases, GCC versions < 6 and MSVC versions as new as 19.10 don't do this optimization: godbolt.org/g/Y5auGY | |
Jun 22, 2018 at 12:54 | comment | added | papagaga |
@0x5453: that's interesting, but do you know of a compiler which doesn't run constexpr functions at compile-time when called with arguments that are known at compile-time? You'd need that to prove me incorrect, even technically ;-)
|
|
Jun 22, 2018 at 12:44 | comment | added | 0x5453 |
"Now, whenever you call it with an upper_bound you know at compile-time, it will run at compile-time." Technically this is incorrect; the compiler is not required to run that function at compile time even if the function and its arguments are all constexpr . The only time it is guaranteed to run at compile time is if the result is required at compile time, e.g. if it is saved to a constexpr variable, if it is used as a template parameter, or if it is used in a static_assert .
|
|
Jun 22, 2018 at 10:13 | history | edited | Toby Speight | CC BY-SA 4.0 |
"fold expression" is a term, not a code identifier. Tidy up some minor typos.
|
Jun 22, 2018 at 9:38 | comment | added | eis |
if ( i % " == 0 should be if ( i % 3 == 0 , can't fix it since "edits need to be at least 6 characters"
|
|
Jun 22, 2018 at 5:50 | comment | added | bipll | "bad, because preprocessing leads to a lot of bugs" You should probably not do that preprocessing and only resort to the bug-free one. | |
Jun 22, 2018 at 5:10 | vote | accept | FromTheStackAndBack | ||
Jun 22, 2018 at 5:09 | comment | added | FromTheStackAndBack |
Before you posted this answer, I was going to generalize the code by storing all modulo values in a vector and iterating through them in an if statement. I think your solution is much more cleaner than mine.
|
|
Jun 22, 2018 at 5:08 | comment | added | FromTheStackAndBack |
fold expressions are definitely new to me! I will take a closer look at them soon.
|
|
Jun 21, 2018 at 14:38 | comment | added | papagaga | It's quite possible, I don't remember the exact title | |
Jun 21, 2018 at 14:29 | comment | added | Rakete1111 | Are you referring to "constexpr ALL the Things"? | |
Jun 21, 2018 at 10:46 | history | answered | papagaga | CC BY-SA 4.0 |