Hot answers tagged

8 votes
Accepted

Checking to see if the current time is close to 9PM

This is already in the Standard Library. Use std::chrono::utc_clock from <chrono>, and compute the duration: ...
Davislor's user avatar
  • 6,881
6 votes
Accepted

Function templates for serializing/deserializing POD types

This is not a good idea To answer your questions directly: Are the two function templates below well-formed for serializing/deserializing POD types? Yes, they are “well-formed”. Will they work for ...
indi's user avatar
  • 11k
6 votes

Function templates for serializing/deserializing POD types

Personal opinion here (so take or leave as you like). Putting the bool here on a separate line to the function makes it harder to parse for me. I always look for ...
Martin York's user avatar
  • 94.6k
4 votes

De/Serialize uint32_t from/to ASCII to use it in Arduino code

design of Public API bool sr( ... ) That is the Public API that you chose to define. That's what you're telling potential callers about your single responsibility. ...
J_H's user avatar
  • 22.3k
2 votes

Extending callable signature with std::optional in context of function composition (make_skippable)

Design review This was a neat idea in 2017. I don’t think it’s really got the same shine in 2024. More recent C++ offers more and better options There are more “Maybe” types In C++17, ...
indi's user avatar
  • 11k
2 votes
Accepted

Order guaranteed recursive_transform template function implementation with execution policy in C++

The mutexes inhibit parallel execution You use a mutex at each recursion level. This inhibits parallel execution of std::transform(). This defeats the purpose of ...
G. Sliepen's user avatar
  • 54.3k
1 vote
Accepted

A recursive_transform_reduce Template Function with Unwrap Level Implementation in C++

Incorrect handling of the init parameter Given this piece of code: ...
G. Sliepen's user avatar
  • 54.3k
1 vote
Accepted

C++ inline minimalist thread pool

Code style This code is terrible to read; the formatting is inconsistent, sometimes there are multiple statements per line, sometimes not. There are comments in the middle of lines, making it easy to ...
G. Sliepen's user avatar
  • 54.3k

Only top scored, non community-wiki answers of a minimum length are eligible