Remix.run Logo
webdevver a day ago

for me, its C++11. the absolute pinnacle of mankind.

everything has been going downhill since then. coincidence? i think not!

medler a day ago | parent [-]

The new changes in C++14, 17, and 20 are really nice. It feels like the language keeps getting cleaner and easier to use well

spacechild1 a day ago | parent [-]

Yes! Just to list a few personal highlights:

C++14:

  - generalized lambda capture
  - generic lambdas
C++17:

  - structured bindings
  - init statement for if
  - class template argument deduction (CTAD)
  - std::string_view
  - std::filesystem
  - std::variant
  - std::optional
  - std::to_chars() and std::from_chars()
C++20:

  - std::format
  - coroutines (makes ASIO code so much cleaner!)
  - concepts
  - std::span
  - bit manipulation (<bit>)
  - std::bind_front
  - std::numbers (math constants)
mrlongroots a day ago | parent [-]

Same, I don't understand the complaints against modern C++. A lambda, used for things like comparators etc, is much simpler than structs with operators overloaded defined elsewhere.

My only complaint is the verbosity, things like `std::chrono::nanonseconds` break even simple statements into multiple lines, and you're tempted to just use uint64_t instead. And `std::thread` is fine but if you want to name your thread you still need to get the underlying handle and call `pthread_setname_np`. It's hard work pulling off everything C++ tries to pull off.

spacechild1 a day ago | parent | next [-]

> And `std::thread` is fine but if you want to name your thread you still need to get the underlying handle and call `pthread_setname_np`.

Yes, but here we're getting deep into platform specifics. An even bigger pain point are thread priorities. Windows, macOS and Linux differ so fundamentally in this regard that it's really hard to create a meaningful abstraction. Certain things are better left to platform APIs.

nuertey2025 a day ago | parent | prev [-]

```c++

// To lessen verbosity, try defining the following convenience aliases in a header:

using SystemClock_t = std::chrono::system_clock;

using SteadyClock_t = std::chrono::steady_clock;

using HighClock_t = std::chrono::high_resolution_clock;

using SharedDelay_t = std::atomic<SystemClock_t::duration>;

using Minutes_t = std::chrono::minutes;

using Seconds_t = std::chrono::seconds;

using MilliSecs_t = std::chrono::milliseconds;

using MicroSecs_t = std::chrono::microseconds;

using NanoSecs_t = std::chrono::nanoseconds;

using DoubleSecs_t = std::chrono::duration<double>;

using FloatingMilliSecs_t = std::chrono::duration<double, std::milli>;

using FloatingMicroSecs_t = std::chrono::duration<double, std::micro>;

```