• 0 Posts
  • 8 Comments
Joined 9 months ago
cake
Cake day: February 5th, 2026

help-circle

  • A few examples:

    • CTAD: Instead of std::pair<int, int> myPair{ 1, 2 }, you just write std::pair myPair{ 1, 2 }
    • std::optional, std::variant and std::any
    • Guaranteed copy elision in some cases, making it more feasible to apply the rule of 5 everywhere
    • Attributes like [[nodiscard]] (compiler warning if an object or return value is discarded) and [[fallthrough]] (suppress a switch fallthrough warning)
    • Generic lambdas ([](auto it){ /* do something */ })
    • std::string_view, which is much safer as a function parameter than const char*


  • You can’t have % in a URL unless you have a hex octet after it. If you want to search for ‘%’, then you need to URL-encode the %.

    URL-encoded % is %25. You might have seen before that URL-encoded space is %20 (though underscore is often used for search queries).


  • Like all of the footguns in C++, it’s only a problem if the codebase uses it wrong. When used correctly (i.e. only when behaviours mimic built-in types, and without side effects), it helps makes code more readable

    Don’t do what numpy does, which is to define * for two arrays. Without learning the library, you wouldn’t know whether this performs element-wise multiplication, matrix multiplication, dot product or cross product. Worse yet, it behaves differently to Python’s built-in * for lists (which is also bad), which concatenates N copies of the list




  • glibg10b@lemmy.ziptomemes@lemmy.world•Buy bitcoin, bro
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    15 days ago

    Money doesn’t grow on trees. In the case of crypto, it came from the people who lost, or the people who are still in it

    I don’t think there’s any hope for the people who are still in it. This 4-year cycle has already been quite disappointing than the previous ones, and there’s no reason for things to improve from here